问题
I have a web service that is making a HTTP POST request to "abc" API. For the POST request I need to have 3 things in the header , the customer id, secret key and content-type. For this POST request I will also have a raw json object in the request body. Upon successful POST, the abc API will return a response. The issue I'm having is the web service is modifying the "content-type" of the header to "text/xml" automatically even if I have it as "application/json".
I have to create a temporary workaround before the the bug in the web service is fixed. I was thinking of creating a proxy server on google app engine that I would make the request to instead. This proxy server would need to have code to correct the header type to "application/json", send the request with the original request header + request body and get the response from "abc" API.
How can I prevent this from happening? I have run POST tests on the API from Postman and I get the correct response from it. It is only when I do the POST request from my web service that the content-type is being overriden at the time of the request. I am not familiar with header content-type.
来源:https://stackoverflow.com/questions/60538094/content-type-header-being-overwritten-during-post-request