DWQA QuestionsCategory: Development Toolweex stream. Feech post JSON setting headers:content-type is invalid
Bunny asked 2 months ago

Stream request!
clipboard.png
The headers and content type of the actual post remain unchanged:
clipboard.png
clipboard.png,

//Pseudo code
fetch('api',{
    method: 'POST',
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
    },
    body: {}
})

Try this,Not only ‘content type’:’application/json} needs to be set, but also the body should be set to JSON format

2 Answers
zwwill_ Muyu answered 2 months ago
//Pseudo code
fetch('api',{
    method: 'POST',
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
    },
    body: {}
})

Try this

Id_dream answered 2 months ago

Not only ‘content type’:’application/json} needs to be set, but also the body should be set to JSON format