Update http.js

This commit is contained in:
Namhyeon Go 2022-01-13 16:59:30 +09:00 committed by GitHub
parent edca0f9d45
commit 8b4e2c1e66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -265,8 +265,8 @@ var HTTPObject = function(engine) {
if (url.indexOf(':' + k) > -1) { if (url.indexOf(':' + k) > -1) {
url = url.replace(':' + k, this.parameters[k]); url = url.replace(':' + k, this.parameters[k]);
} else if(this.parameters[k] == "{uuidv4}") { } else if(this.parameters[k] == "{uuidv4}") {
parameters[k] = uuidv4(); // Generate UUID v4 parameters[k] = uuidv4(); // Generate UUID v4
} else { } else {
parameters[k] = this.parameters[k]; parameters[k] = this.parameters[k];
} }
} }
@ -348,7 +348,7 @@ var HTTPObject = function(engine) {
// Make CURL context // Make CURL context
var state = this.states[this.states.length - 1]; var state = this.states[this.states.length - 1];
var cmd = ["bin\\curl", "-X", this.method]; var cmd = ["bin\\curl", "-X", this.method];
var url = state.url; var url = state.url;
if (Object.keys(this.headers).length > 0) { if (Object.keys(this.headers).length > 0) {
for (var key in this.headers) { for (var key in this.headers) {
@ -370,14 +370,14 @@ var HTTPObject = function(engine) {
cmd.push(this.userAgent); cmd.push(this.userAgent);
} }
var pos = url.indexOf('?'); var pos = url.indexOf('?');
if (pos > -1) { if (pos > -1) {
cmd.push("-d"); cmd.push("-d");
cmd.push(state.url.substring(pos + 1)); cmd.push(state.url.substring(pos + 1));
cmd.push(state.url.substring(0, pos)); cmd.push(state.url.substring(0, pos));
} else { } else {
cmd.push(state.url); cmd.push(state.url);
} }
// Get response text // Get response text
responseText = this.interface.exec(cmd); responseText = this.interface.exec(cmd);