avadev/AvaTax-REST-V2-JS-SDK

restCall contentType

awhitford opened this issue · 2 comments

This code looks invalid:

	  var contentType = res.headers._headers['content-type'][0];

I don't see that Headers has a _headers property.
Also, not sure if the case of Content-Type matters, but the HTTP convention is Content-Type (not content-type).

I think it should be:

	  var contentType = res.headers.get('Content-Type');

We are actually running into this issue. rest.headers._headers['content-type'] causes an Error, because _headers is undefined. Because it's res.headers is a JS Map the SDK should be using the get() function to retrieve items from the map. Could the AvaTax developers comment on this? Perhaps the _headers['xxx'] is a syntax I'm unaware of?

If you look at the latest version 22.5.0 we are now using node-fetch and the syntax should look much more familiar. Please let me know if you see any other issues.
image