Polymer-ajax core won't host JSON?

I use core-ajax to get JSON data just fine. Moving a component around to send it back to the server, since JSON is another. In all cases, regardless of the contentType or handleAs parameters, I found that my JSON object, which I pass as input, is converted back to the key = value in the server headers.

The code:

var ajax = document.querySelector('core-ajax');

ajax.method = 'POST';
ajax.handleAs = 'JSON';
ajax.contentType = 'application/json';
ajax.params = JSON.stringify(data);

ajax.go();

Really simple. Logs in Go give me:

2014/07/22 14:23:09 utils.go:139: OPTIONS /1/users/173?access_token=(token)
2014/07/22 14:23:09 utils.go:124: POST /1/users/173?access_token=(token)
2014/07/22 14:23:09 users.go:379: full_name=Greg%20Johnson

We checked that no changes are taking place on our side. Request headers come out very well.

I could have missed something at all. How else can we successfully execute POST from JSON data?

+4
source share
1 answer

.params URL-. JSON ? , .body:

:

ajax.body = data

. https://github.com/Polymer/core-ajax/blob/master/core-ajax.html#L151

+13

All Articles