mirror of
https://github.com/foss42/apidash.git
synced 2025-05-22 16:57:07 +08:00
Fixes
This commit is contained in:
@ -95,7 +95,6 @@ echo $response . "\n";
|
|||||||
String? getCode(RequestModel requestModel) {
|
String? getCode(RequestModel requestModel) {
|
||||||
try {
|
try {
|
||||||
String result = "";
|
String result = "";
|
||||||
bool hasQuery = false;
|
|
||||||
bool hasBody = false;
|
bool hasBody = false;
|
||||||
|
|
||||||
var rec = getValidRequestUri(
|
var rec = getValidRequestUri(
|
||||||
@ -114,8 +113,7 @@ echo $response . "\n";
|
|||||||
result += templateUri.render({'uri': stripUriParams(uri)});
|
result += templateUri.render({'uri': stripUriParams(uri)});
|
||||||
|
|
||||||
//renders the request body contains the HTTP method associated with the request
|
//renders the request body contains the HTTP method associated with the request
|
||||||
if (kMethodsWithBody.contains(requestModel.method) &&
|
if (requestModel.hasBody) {
|
||||||
requestModel.hasBody) {
|
|
||||||
hasBody = true;
|
hasBody = true;
|
||||||
// contains the entire request body as a string if body is present
|
// contains the entire request body as a string if body is present
|
||||||
var templateBody = jj.Template(kTemplateBody);
|
var templateBody = jj.Template(kTemplateBody);
|
||||||
@ -129,7 +127,6 @@ echo $response . "\n";
|
|||||||
//checking and adding query params
|
//checking and adding query params
|
||||||
if (uri.hasQuery) {
|
if (uri.hasQuery) {
|
||||||
if (requestModel.enabledParamsMap.isNotEmpty) {
|
if (requestModel.enabledParamsMap.isNotEmpty) {
|
||||||
hasQuery = true;
|
|
||||||
var templateParams = jj.Template(kTemplateParams);
|
var templateParams = jj.Template(kTemplateParams);
|
||||||
result += templateParams
|
result += templateParams
|
||||||
.render({"params": requestModel.enabledParamsMap});
|
.render({"params": requestModel.enabledParamsMap});
|
||||||
@ -137,13 +134,10 @@ echo $response . "\n";
|
|||||||
}
|
}
|
||||||
|
|
||||||
var headers = requestModel.enabledHeadersMap;
|
var headers = requestModel.enabledHeadersMap;
|
||||||
if (requestModel.hasBody) {
|
if (requestModel.hasBody && !requestModel.hasContentTypeHeader) {
|
||||||
if (!headers.containsKey('Content-Type')) {
|
if (requestModel.hasJsonData || requestModel.hasTextData) {
|
||||||
if (requestModel.hasJsonData) {
|
headers[kHeaderContentType] =
|
||||||
headers['Content-Type'] = 'application/json';
|
requestModel.requestBodyContentType.header;
|
||||||
} else if (requestModel.hasTextData) {
|
|
||||||
headers['Content-Type'] = 'text/plain';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user