Content-Type is not added in the post request header of axios
<p>I am using axios and trying to send javascript code for post request in the following format</p>
<pre class="brush:php;toolbar:false;">let api_post_request = async (resourcePath, params, file, options) => {
let headers = {
...(getAccessToken()),
'Content-Type' : 'multipart/form-data'
};
try{
await axios({
method: 'post',
headers: headers,
baseURL: `${Constants.PATH.BASE_URL}`,
url: `${resourcePath}`,
...(params ? { params: params } : ""),
...(file ? {data : {file : file}} : "")
});
}</pre>
<p>The Bearer token is set in the Authorization key, but the Content-Type is not found in the request header in the Network tab. Am I using the correct request format? Due to this issue, I get the <strong>Request failed with status code 415</strong> error. </p>