nopCommerce 4.50 + ShipStation = Error

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
2 years ago
I installed a new instance of nopCommerce 4.50 and configured ShipStation.

I tested and confirmed the ShipStation connection.

On step 3 (Shipping Method) of checkout, the following error message is displayed and logged.

Misused header name, 'Content-Type'. Make sure request headers are used with HttpRequestMessage, response headers with HttpResponseMessage, and content headers with HttpContent objects.

Page URL: /checkout/OpcSaveBilling/

Any insight into this error would be greatly appreciated.
2 years ago
This error means that you should set Content-Type header
for more you can check this link https://docs.microsoft.com/en-us/answers/questions/578604/misused-header-name-make-sure-request-headers-are.html
2 years ago
Thanks!  After reading up on this, I was able to find a work around.  

This seems like a bug that needs reported to the development team.  

I updated the GetRatesAsync method in ShipStationServices.cs (starting on line 263)

From this:

client.DefaultRequestHeaders.Add("Content-Type", CONTENT_TYPE);
var responseData = await client.PostAsync($"{API_URL}{LIST_RATES_CMD}", new StringContent(JsonConvert.SerializeObject(postData)));


To this:

var httpContent = new StringContent(JsonConvert.SerializeObject(postData),Encoding.UTF8,CONTENT_TYPE);
var responseData = await client.PostAsync($"{API_URL}{LIST_RATES_CMD}", httpContent);
var data = await responseData.Content.ReadAsStringAsync();


That resolved the issue.
2 years ago
Bug reported.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.