angularjs - $http.get() with JSON data -
i'm writing server app , wanted client use data in body pararmeterize method, this:
# http -v http://localhost:3000/url text=123 foo=bar /url http/1.1 accept: application/json accept-encoding: gzip, deflate, compress content-length: 29 content-type: application/json; charset=utf-8 host: localhost:3000 user-agent: httpie/0.4.0 { "foo": "bar", "text": "123" }
in angularjs tried:
var params = { "foo": "bar", "text": "123" } // no body $http({ method: 'get', url: '/url', data: params }) // ugly url // has limitation: http://stackoverflow.com/questions/978061/http-get-with-request-body $http({ method: 'get', url: '/url', params: params }) // params in body, wanted $http({ method: 'post', url: '/url', data: params })
is design or bug?
i cannot see why documentation.
i take answer:
for http, it's not prohibited, shouldn't use server may (and should) ignore body of get
request.
reference: http request body
for xhr, body of get
, head
ignored (hinted @jacob-koshy).