Update http.js

This commit is contained in:
Namhyeon Go 2022-06-09 11:57:02 +09:00 committed by GitHub
parent d25a12bd8b
commit ff00f3cf5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -544,19 +544,6 @@ var HTTPObject = function(engine) {
return this;
};
this.post = function(url, callback, onError) {
try {
if (this.jqEnabled()) {
this.setMethod("POST");
this.jqAjax(url, callback, onError);
} else {
return this.open("POST", url).send(callback);
}
} catch (e) {
if (typeof onError === "function") onError(this, null, e);
}
};
this.get = function(url, callback, onError) {
try {
if (this.jqEnabled()) {
@ -570,6 +557,19 @@ var HTTPObject = function(engine) {
}
};
this.post = function(url, callback, onError) {
try {
if (this.jqEnabled()) {
this.setMethod("POST");
this.jqAjax(url, callback, onError);
} else {
return this.open("POST", url).send(callback);
}
} catch (e) {
if (typeof onError === "function") onError(this, null, e);
}
};
this.patch = function(url, callback, onError) {
try {
if (this.jqEnabled()) {
@ -583,6 +583,32 @@ var HTTPObject = function(engine) {
}
};
this.put = function(url, callback, onError) {
try {
if (this.jqEnabled()) {
this.setMethod("PUT");
this.jqAjax(url, callback, onError);
} else {
return this.open("PUT", url).send(callback);
}
} catch (e) {
if (typeof onError === "function") onError(this, null, e);
}
};
this.delete = function(url, callback, onError) {
try {
if (this.jqEnabled()) {
this.setMethod("DELETE");
this.jqAjax(url, callback, onError);
} else {
return this.open("DELETE", url).send(callback);
}
} catch (e) {
if (typeof onError === "function") onError(this, null, e);
}
};
this.pushState = function(state, title, url) {
this.states.push({
"state": state,