bhushankummar / eBay-node-client

Ebay NodeJS Wrapper
MIT License
54 stars 66 forks source link

Remove content-length header from put and post requests #16

Closed 2mt-heuser closed 4 years ago

2mt-heuser commented 5 years ago

It is not required by eBay and str.length running in node / utf-16 may report wrong sizes if the string contains special characters like accents or german umlauts and gets transfered as utf-8 / json afterwards

@see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length#Description @see https://developer.ebay.com/api-docs/static/rest-request-components.html

The following error happens when the article.title contains german umlauts.

[{
      "errorId":2004,
      "domain":"ACCESS",
      "category":"REQUEST",
      "message":"Invalid request",
      "longMessage":"The request has errors. For help, see the documentation for this API.",
      "parameters":[
         {
            "name":"reason",
            "value":"Unexpected end-of-input: expected close marker for OBJECT (from [Source: java.io.ByteArrayInputStream line: 1, column: 90])"
         }
      ]
}]

Removing the content-length solves all of that.

bhushankummar commented 5 years ago

@2mt-heuser Thank you for contribution. I will look into that and merge it.