I am working on a project that requires me to set authorization in my headers but once the authorization is set on my fetch function it isn't available in my backend as a key value pair instead the is sent without the value
This is the javascript code i use
fetch('http://127.0.0.1:8000/api/v1/virtual_wallets/create_payment/', {
method: 'POST',
headers: {
"Content-Type": "application/json; charset=UTF-8",
"Custom-Sk-Header": "custom-header",
"Authorization": "Bearer token"
},
body: {
"amount": "200"
}
}).then(async function (res) {
await res.json()
console.log(res.json())
return res.json();
}).then(function (orderData) {
return orderData.id;
});
this is what i get on the backend the authorization is not a dictinary instead its just a value under Access-Control-Request-Headers
{'Content-Length': '', 'Content-Type': 'text/plain', 'Access-Control-Request-Method': 'POST', 'Access-Control-Request-Headers': 'access-control-allow-credentials,access-control-allow-headers,access-control-allow-methods,access-control-allow-origin,authorization,instasaw-sk-header', 'Origin': 'http://localhost:63342',......}
The main problem is my headers set are not standing on their own but showing as a value on Access-Control-Request-Headers