+ 1
Hey Coders, Need help with one MCQ Question
fetch (url, { method: 'post', headers: { "Content-type": ------------- }, body: 'foo=bar & lorem=ipsum' }) After considering snippet above which of the following values for the Content-Type header is/are correct? A) application/x-www-form-urlencoded; charset=UTF-8 B) text/html; charset=utf-8 C)application/json; charset=UTF-8 D)Content-Type: multipart/form-data; boundry=something According to me B and D is correct but test is failing me. Anu suggestions?
2 Réponses
+ 1
As i use thunder extension in Visual studio to GET or POST data . I always use
header: {
"Content-type":"application/json";
}
and i think it's necessary to add.
0
fetch api make use of application/json. This is ES6 alternative to XMLHttpRequest() object