I've got some problems with the encoding of the request depending on the browser.
The below dumps show headers that differ between FF and Chrome (I removed all equal headers). See the representation of the "search" value:
Firefox: Ok
Accept-Language: es-ar,es;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: application/json;charset=utf-8
POST: {"data":{"size":10,"search":"José","order":"name","page":1}}
Chrome: Not ok
Pragma: no-cache
Cache-Control: no-cache
Origin: http://localhost
Content-Type: application/json;charset=UTF-8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: es-ES,es;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
POST: {"data":{"size":10,"search":"José","order":"name","page":1}}
IE Don't work
I tried to force the Content-Type in $http, but nothing. The responses in both browser work ok. I'm using Apache over Win 7 "por si las moscas".
Important: The request have bad format before being sent to the server, the above headers I to take from Firebug and Chrome inspect.
Any idea? Thanks!
José
UPDATE
I make url encode to the post, and decode in the server, I notice that with UTF-8 the url decode work bad, but with ISO-8859-1 work fine. Then the browser is send the post with ISO-8859-1?
According to the w3 spec, charset ISO-8859-1
is default when nothing is specified or no Accept-Charset
header is present. It's likely the other charsets fouling things up.
try undefining that header:
$http({
method: 'POST',
url: '/page.html',
headers: { 'Accept-Charset': undefined }
})
.success(function(){ /*success fn here*/ });