You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'll am investigating this issue.
but anyway, your requirement doesn't seems to be addressed with this code snippet regardless of the issue.
to send a json string as the POST's content, set the data as a string.
If the REST service does a JSON parse it'll work. But since the post() data parameter can be a string or an object I guess Jaggery should handle the Object option better with support for nested Objects.
If one runs:
<%
var url = 'http://jaggeryjs.org/apidocs/resources/data.jag';
var result = post(url,
{"key": {
"primary":"foo",
"secondary":"bar"}
},
{
"User-Agent" : "Jaggery-XHR",
"Country" : "LK"
},
'json');
print(result.data);
%>
at http://jaggeryjs.org/apidocs/post.jag "try it" feature, gets as result:
{"method" : "POST", "url" : "http://jaggeryjs.org/apidocs/resources/data.jag", "content" : "key=%5Bobject%20Object%5D", "headers" : {"host" : "jaggeryjs.org", "user-agent" : "Jaggery-XHR", "country" : "LK", "x-forwarded-for" : "204.13.82.231", "x-forwarded-host" : "jaggeryjs.org", "x-forwarded-server" : "jaggeryjs.org", "connection" : "Keep-Alive", "content-length" : "25"}}
The content posted is key=%5Bobject%20Object%5D instead of
{"key": { "primary":"foo", "secondary":"bar"} }
The text was updated successfully, but these errors were encountered: