Jump to content

Bug In Postalmethods Api Causing A 400 Bad Request


NETLINK

Recommended Posts

There's a bug either in the PostalMethods API or in the InvoiceDelivery class that's causing PostalMethods to return a 400 Bad Request respsonse header with 0-length response body.

 

It took me a long time to figure out, because Blesta wasn't returning an error message, just a "-1" error code, which is obviously meaningless, and nothing being logged.

 

I eventually got myself the response code from the Http curl wrapper class, which came back with "400".

 

I then extracted the $xml as string from the PostalMethods class before it was sent, and I did a manual post request to PostalMethods directly.

 

It came back with the following response:

HTTP/1.1 400 Bad Request
Date: Tue, 12 Apr 2016 19:17:05 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Length: 0

It turned out that the cause was an ampersand (&) in the company name:

 

<Company>Example & Co. Accountants</Company>

 

So, I'm guessing, the data is not being properly encoded, at least for the Company element.

 

 

Link to comment
Share on other sites

  • 2 weeks later...
Guest
This topic is now closed to further replies.
×
×
  • Create New...