JQuery Ajax GET and contentType?

Relatively: (jQuery ajax method):

Is the contentType property taken into account when the request itself is a GET request? (Example)

 $.ajax({ type: "GET", url: "/webservices/xxx.asmx/yyy", data: JSON.stringify({ Markers: markers }), contentType: "application/json; charset=utf-8", dataType: "json",....... }); 

ps

contentType is a form of data that I send to the server
dataType is a form of data that I EXPECT to receive from the server.

+6
source share
2 answers

According to RFC 2616 , it is not forbidden to use the request body in GET requests.
However, I would like to know about a client implementation that sends data to the body and a server implementation that analyzes the data in the body of the GET requests.

Basically, no, the Content-Type header is not used.

+9
source

Receive requests should not have a content type because they do not have a request body. Therefore, I would say no, this is not necessary.

0
source

Source: https://habr.com/ru/post/949749/


All Articles