9

Regarding : (jQuery ajax method) :

Does contentType property is counted 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",.......

});

p.s.

contentType is the form of data which i send to the server
dataType is the form of data which i EXPECT to get from server.

Royi Namir
  • 144,742
  • 138
  • 468
  • 792
  • possible duplicate of [Do I need a content type for http get requests?](http://stackoverflow.com/questions/5661596/do-i-need-a-content-type-for-http-get-requests) – adeneo Jul 18 '13 at 13:43
  • @adeneo perfectly duplicate. thanks. didnt see that.( however i will vote to delete) – Royi Namir Jul 18 '13 at 13:44

2 Answers2

10

According to the RFC 2616, it's not forbidden to use the request body in GET requests.
However, I'd like to know of an client implementation which does send data in the body and an server implementation which parses data in the body of GET requests.

So basically, no, the Content-Type header is not used.

gustavohenke
  • 40,997
  • 14
  • 121
  • 129
0

Get requests should not have content-type because they do not have request body. So I would say no, it's not needed.

André Snede
  • 9,899
  • 7
  • 43
  • 67
  • 1
    @BenjaminGruenbaum they have an empty body IMHO – Royi Namir Jul 18 '13 at 13:45
  • @BenjaminGruenbaum did i say its forbidden or impossible ? I jsut said that the body is empty. you can create a fiddler request with get and full body content and it still gonna work. – Royi Namir Jul 18 '13 at 13:47