From adec1afd751dc13708cefd79f6b64218800a4c12 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Thu, 9 Jun 2022 14:00:59 +0900 Subject: [PATCH] Update http.js --- lib/http.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/http.js b/lib/http.js index 3547fb2..3b41e18 100644 --- a/lib/http.js +++ b/lib/http.js @@ -95,16 +95,22 @@ var HTTPObject = function(engine) { }; this.jqAjax = function(url, callback, onError) { - this.setResponseBody(window.jQuery.ajax({ + var options = { type: this.method, headers: this.headers, url: this.serializeParameters(url), - data: this.requestBody, + //data: this.requestBody, contentType: this.contentType, success: callback, async: this.isAsynchronous, error: onError // (request, status, error) - }).responseText); + }; + + if (["POST", "PUT", "PATCH"].indexOf(this.method) > -1) { + options['data'] = this.requestBody; + } + + this.setResponseBody(window.jQuery.ajax(options).responseText); }; this.isJSONRequest = function() {