This repository was archived by the owner on Jan 10, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -380,7 +380,7 @@ if (forcetk.Client === undefined) {
380380 * @param callback function to which response will be passed
381381 * @param [error=null] function to which jqXHR will be passed in case of error
382382 * @param [method="GET"] HTTP method for call
383- * @param [payload=null] payload for POST/PATCH etc
383+ * @param [payload=null] string or object with payload for POST/PATCH etc or params for GET
384384 * @param [paramMap={ }] parameters to send as header values for POST/PATCH etc
385385 * @param [retry] specifies whether to retry on error
386386 */
@@ -389,10 +389,28 @@ if (forcetk.Client === undefined) {
389389 var that = this ,
390390 url = this . instanceUrl + '/services/apexrest' + path ;
391391
392+ method = method || "GET" ;
393+
394+ if ( method === "GET" ) {
395+ // Handle proxied query params correctly
396+ if ( this . proxyUrl && payload ) {
397+ if ( typeof payload !== 'string' ) {
398+ payload = $ . param ( payload ) ;
399+ }
400+ url += "?" + payload ;
401+ payload = null ;
402+ }
403+ } else {
404+ // Allow object payload for POST etc
405+ if ( payload && typeof payload !== 'string' ) {
406+ payload = JSON . stringify ( payload ) ;
407+ }
408+ }
409+
392410 return $ . ajax ( {
393- type : method || "GET" ,
411+ type : method ,
394412 async : this . asyncAjax ,
395- url : ( this . proxyUrl !== null ) ? this . proxyUrl : url ,
413+ url : this . proxyUrl || url ,
396414 contentType : 'application/json' ,
397415 cache : false ,
398416 processData : false ,
You can’t perform that action at this time.
0 commit comments