mirror of
https://github.com/foss42/apidash.git
synced 2025-05-30 05:21:15 +08:00
[ISSUE 375] - request initialization and body setup
This commit is contained in:
@ -154,21 +154,7 @@ echo $response;
|
|||||||
result += templateHeader.render({'headers': headers});
|
result += templateHeader.render({'headers': headers});
|
||||||
}
|
}
|
||||||
|
|
||||||
// contains the HTTP method associated with the request
|
result += kStringRequestInit;
|
||||||
var method = requestModel.method;
|
|
||||||
|
|
||||||
// contains the entire request body as a string if body is present
|
|
||||||
var requestBody = requestModel.requestBody;
|
|
||||||
|
|
||||||
//renders the request body
|
|
||||||
if (kMethodsWithBody.contains(method) && requestBody != null) {
|
|
||||||
var contentLength = utf8.encode(requestBody).length;
|
|
||||||
if (contentLength > 0) {
|
|
||||||
hasBody = true;
|
|
||||||
var templateBody = jj.Template(kTemplateBody);
|
|
||||||
result += templateBody.render({"body": requestBody});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//renders the request temlate
|
//renders the request temlate
|
||||||
var templateRequest = jj.Template(kTemplateRequest);
|
var templateRequest = jj.Template(kTemplateRequest);
|
||||||
@ -180,7 +166,7 @@ echo $response;
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (hasBody || requestModel.hasFormData) {
|
if (hasBody || requestModel.hasFormData) {
|
||||||
result += kStringRequestBody;
|
result += kStringRequestBodyOpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
//and of the request
|
//and of the request
|
||||||
|
Reference in New Issue
Block a user