AngularJS+$http+POSTの際のrequest body
AngularJSの$hostのPOSTメソッドを使ってデータを送信する際、Content-Typeがapplication/jsonになって送信される事がある。
文字列を送る場合等は、以下のようにすれば良い。
$http({ method: "POST", data : '{"Json":"like","string":"death"}', url: "http://localhost/", headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' } }). success(function(data, status, headers, config) { }). error(function(data, status, headers, config) { });
要はContent-Typeを「application/x-www-form-urlencoded」にしてるだけ。
ハマった…