feat: support for binary body (#4466)

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
This commit is contained in:
Akash K
2024-11-26 19:48:01 +05:30
committed by GitHub
parent 37bf0567ea
commit 80d7dd046d
16 changed files with 261 additions and 22 deletions

View File

@@ -7,6 +7,7 @@ export const knownContentTypes = {
"text/xml": "xml",
"application/x-www-form-urlencoded": "multipart",
"multipart/form-data": "multipart",
"application/octet-stream": "binary",
"text/html": "html",
"text/plain": "plain",
}

View File

@@ -41,6 +41,10 @@ export const HoppRESTReqBody = z.union([
body: z.array(FormDataKeyValue).catch([]),
showIndividualContentType: z.boolean().optional().catch(false),
}),
z.object({
contentType: z.literal("application/octet-stream"),
body: z.instanceof(File).nullable().catch(null),
}),
z.object({
contentType: z.union([
z.literal("application/json"),
@@ -50,6 +54,7 @@ export const HoppRESTReqBody = z.union([
z.literal("application/xml"),
z.literal("text/xml"),
z.literal("application/x-www-form-urlencoded"),
z.literal("binary"),
z.literal("text/html"),
z.literal("text/plain"),
]),