fix: ensure Content-Type header priority in the CLI (#4242)
- Ensure the `Content-Type` header takes priority over the value set in the request body. - Introduces `HoppRESTRequest` schema `v6` with `text/xml` added under the supported content types.
This commit is contained in:
@@ -162,12 +162,18 @@ export function getEffectiveRESTRequest(
|
||||
}
|
||||
const effectiveFinalBody = _effectiveFinalBody.right;
|
||||
|
||||
if (request.body.contentType)
|
||||
if (
|
||||
request.body.contentType &&
|
||||
!effectiveFinalHeaders.some(
|
||||
({ key }) => key.toLowerCase() === "content-type"
|
||||
)
|
||||
) {
|
||||
effectiveFinalHeaders.push({
|
||||
active: true,
|
||||
key: "content-type",
|
||||
key: "Content-Type",
|
||||
value: request.body.contentType,
|
||||
});
|
||||
}
|
||||
|
||||
// Parsing final-endpoint with applied ENVs.
|
||||
const _effectiveFinalURL = parseTemplateStringE(
|
||||
|
||||
Reference in New Issue
Block a user