mirror of
https://github.com/postmanlabs/openapi-to-postman.git
synced 2022-11-29 22:05:00 +03:00
Skip automatic header addition when "keepImplicitHeaders" is active, to prevent duplicate headers.
This commit is contained in:
@@ -1878,12 +1878,10 @@ module.exports = {
|
||||
raw: JSON.stringify(bodyData, null, 4)
|
||||
};
|
||||
|
||||
if (!options.keepImplicitHeaders) {
|
||||
contentHeader = new sdk.Header({
|
||||
key: 'Content-Type',
|
||||
value: bodyType
|
||||
});
|
||||
}
|
||||
|
||||
reqBody.update(updateOptions);
|
||||
}
|
||||
@@ -2358,7 +2356,9 @@ module.exports = {
|
||||
}
|
||||
pmBody = this.convertToPmBody(reqBody, REQUEST_TYPE.ROOT, components, options, schemaCache);
|
||||
item.request.body = pmBody.body;
|
||||
if (!options.keepImplicitHeaders || (reqParams.header && reqParams.header.length === 0)) {
|
||||
item.request.addHeader(pmBody.contentHeader);
|
||||
}
|
||||
// extra form headers if encoding is present in request Body.
|
||||
// TODO: Show warning for incorrect schema if !pmBody.formHeaders
|
||||
pmBody.formHeaders && pmBody.formHeaders.forEach((element) => {
|
||||
|
||||
Reference in New Issue
Block a user