AngularJS ignores content-type for GET requests

3

In my Angular 1 application, I am using $httpProvider to be able to default to all content-type methods, but for GET methods, it does not send in its header. How can I force the angle to set the content-type in the GET methods?

No config

$httpProvider.defaults.headers.common['Content-Type'] = 'application/json';

Console

Request

    
asked by anonymous 19.10.2017 / 14:52

1 answer

2

This is the correct and expected behavior.

Methods HTTP GET and DELETE do not have payload ; both clients and servers are not required to implement interpreters for a content-Type header in these operations.

Methods that carry payload , such as POST or PUT , may contain the header in your requests.

Source: link

    
19.10.2017 / 19:28