manu george
manu george

Reputation: 65

How to use multiple Content-type in headers of Http Post request

I have this code where there are multiple Content-type keys is used in this POST request. When this request is run I always get an error that a duplicate key is used. I want to know how I can use multiple Content-type in one Content-type key. The header of the request looks like below:-

headers: {
    'Content-Type':'application/json, 
    'Access-Control-Allow-Origin': '*',
   'Content-Type': 'multipart/form-data; charset=utf-8; boundary=' + Math.random().toString().substr(2)
 }

Upvotes: 0

Views: 4904

Answers (1)

Barry Pollard
Barry Pollard

Reputation: 45970

You can’t. Are you sending JSON or Form-Data? It can’t be both so has to be one or the other.

Upvotes: 1

Related Questions