-
Notifications
You must be signed in to change notification settings - Fork 62
Data not passed in POST request using Node #99
Comments
I just looked at At the very least I'd say try serializing that object to a x-www-form-urlencoded string yourself and see if that works. (core's If this makes it inconsistent with the xhr provider then it's probably something we should look at... |
Ah, ok. So this works then. var params = new UrlSearchParams(DATA);
var paramsString = params.toString();
// using dojo-core/request
function getDojoToken(callback){
dojoRequest.post('https://www.arcgis.com/sharing/rest/oauth2/token/',{
responseType: 'json',
query: paramsString
}).then(function(results) {
console.log('dojo request results', results.data);
});
} I suppose I can do a Thanks for clearing that up! |
I think that @kfranqueiro is correct. Strings aren't handled properly as the 'data' field. That test is looking at the response data, not the data received by the server. I'll fix that, but supporting object literals is not currently supported and I can't find evidence that this is planned since it can be accomplished via |
I don't know/remember off the top of my head, but I suspect it might be intentional, given that people have different opinions/requirements as to whether their objects should be serialized simply as JSON, or as www-form-urlencoded strings. |
I think the intention would be that they would use the filterRegistry to deal with whatever needs they have specifically for post processing of requests. |
Issued PR #127 to correct issue where options.data not being sent to server when it contained a non-stream. |
It looks like
core/request/node
is not passing the data values correctly when doing a POST request.Here is a sample to demonstrate.
The errors from
core/request/node
indicate theclient_id
wasn't provided although it was. If I update this with a validclient_secret
I get a valid token using therequest
module, but still get theclient_id
error from the Dojo module.I couldn't quite follow the
core/request/node
code to figure out where data would be sent.Thanks!
The text was updated successfully, but these errors were encountered: