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

@@ -12,6 +12,7 @@ export const knownContentTypes: Record<ValidContentTypes, Content> = {
"multipart/form-data": "multipart",
"text/html": "html",
"text/plain": "plain",
"text/xml": "xml",
}
type ContentTypeTitle =
@@ -33,6 +34,7 @@ export const segmentedContentTypes: SegmentedContentType[] = [
"application/hal+json",
"application/vnd.api+json",
"application/xml",
"text/xml",
],
},
{

View File

@@ -1,4 +1,8 @@
import { Environment, HoppCollection } from "@hoppscotch/data"
import {
Environment,
HoppCollection,
RESTReqSchemaVersion,
} from "@hoppscotch/data"
import { HoppGQLDocument } from "~/helpers/graphql/document"
import { HoppRESTDocument } from "~/helpers/rest/document"
@@ -25,7 +29,7 @@ export const REST_COLLECTIONS_MOCK: HoppCollection[] = [
folders: [],
requests: [
{
v: "5",
v: RESTReqSchemaVersion,
endpoint: "https://echo.hoppscotch.io",
name: "Echo test",
params: [],
@@ -138,7 +142,7 @@ export const REST_HISTORY_MOCK: RESTHistoryEntry[] = [
preRequestScript: "",
testScript: "",
requestVariables: [],
v: "5",
v: RESTReqSchemaVersion,
},
responseMeta: { duration: 807, statusCode: 200 },
star: false,
@@ -194,7 +198,7 @@ export const REST_TAB_STATE_MOCK: PersistableTabState<HoppRESTDocument> = {
tabID: "e6e8d800-caa8-44a2-a6a6-b4765a3167aa",
doc: {
request: {
v: "5",
v: RESTReqSchemaVersion,
endpoint: "https://echo.hoppscotch.io",
name: "Echo test",
params: [],