Permalink
Browse files

Fixed query string not built properly from JSON param in request()(ex…

…pect for GET).
  • Loading branch information...
1 parent 4da5978 commit d8f3b79753e8fd659c0f9f5015cdfb5e6c6f7278 @nicolas-rempulski nicolas-rempulski committed Nov 13, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 source/ajax/Ajax.js
View
@@ -44,7 +44,17 @@ enyo.kind({
var uri = parts.shift() || "";
var args = parts.length ? (parts.join("?").split("&")) : [];
//
- var body = enyo.isString(inParams) ? inParams : enyo.Ajax.objectToQuery(inParams);
+ var body = null;
+ //
+ if(enyo.isString(inParams)){
+ //If inParams parameter is a string, use it as request body
+ body = inParams;
+ }
+ else{
+ //If inParams parameter is not a string, build a query from it
+ args.push(enyo.Ajax.objectToQuery(inParams))
+ }
+ //
if (this.method == "GET") {
if (body) {
args.push(body);

0 comments on commit d8f3b79

Please sign in to comment.