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:
James George
2024-08-07 09:16:27 -07:00
committed by GitHub
parent 31b691bb37
commit a8bcc75467
11 changed files with 290 additions and 32 deletions

View File

@@ -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(