mirror of
https://github.com/foss42/apidash.git
synced 2025-06-05 10:20:44 +08:00
fix: remove redundant multipart header
- reqwest crate will add the headers and boundary itself.
This commit is contained in:
@ -43,8 +43,6 @@ class RustReqwestCodeGen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
""";
|
""";
|
||||||
String kTemplateFormHeaderContentType = '''
|
|
||||||
multipart/form-data; boundary={{boundary}}''';
|
|
||||||
|
|
||||||
int kHeadersPadding = 10;
|
int kHeadersPadding = 10;
|
||||||
|
|
||||||
@ -157,13 +155,6 @@ multipart/form-data; boundary={{boundary}}''';
|
|||||||
var headersList = requestModel.enabledRequestHeaders;
|
var headersList = requestModel.enabledRequestHeaders;
|
||||||
if (headersList != null || hasBody) {
|
if (headersList != null || hasBody) {
|
||||||
var headers = requestModel.enabledHeadersMap;
|
var headers = requestModel.enabledHeadersMap;
|
||||||
if (requestModel.isFormDataRequest) {
|
|
||||||
var formHeaderTemplate =
|
|
||||||
jj.Template(kTemplateFormHeaderContentType);
|
|
||||||
headers[HttpHeaders.contentTypeHeader] = formHeaderTemplate.render({
|
|
||||||
"boundary": uuid,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (headers.isNotEmpty || hasBody) {
|
if (headers.isNotEmpty || hasBody) {
|
||||||
hasHeaders = true;
|
hasHeaders = true;
|
||||||
if (hasBody) {
|
if (hasBody) {
|
||||||
@ -181,7 +172,6 @@ multipart/form-data; boundary={{boundary}}''';
|
|||||||
result += formDataBodyData.render(
|
result += formDataBodyData.render(
|
||||||
{
|
{
|
||||||
"fields_list": json.encode(requestModel.formDataMapList),
|
"fields_list": json.encode(requestModel.formDataMapList),
|
||||||
"boundary": uuid,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -206,7 +196,7 @@ multipart/form-data; boundary={{boundary}}''';
|
|||||||
result += kStringRequestForm;
|
result += kStringRequestForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasHeaders || requestModel.isFormDataRequest) {
|
if (hasHeaders) {
|
||||||
result += kStringRequestHeaders;
|
result += kStringRequestHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user