feat: support for binary body (#4466)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
This commit is contained in:
@@ -43,5 +43,5 @@ export interface EffectiveHoppRESTRequest extends HoppRESTRequest {
|
||||
active: boolean;
|
||||
description: string;
|
||||
}[];
|
||||
effectiveFinalBody: FormData | string | null;
|
||||
effectiveFinalBody: FormData | string | File | null;
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ export async function getEffectiveRESTRequest(
|
||||
function getFinalBodyFromRequest(
|
||||
request: HoppRESTRequest,
|
||||
resolvedVariables: EnvironmentVariable[]
|
||||
): E.Either<HoppCLIError, string | null | FormData> {
|
||||
): E.Either<HoppCLIError, string | null | FormData | File> {
|
||||
if (request.body.contentType === null) {
|
||||
return E.right(null);
|
||||
}
|
||||
@@ -437,6 +437,20 @@ function getFinalBodyFromRequest(
|
||||
);
|
||||
}
|
||||
|
||||
if (request.body.contentType === "application/octet-stream") {
|
||||
const body = request.body.body;
|
||||
|
||||
if (!body) {
|
||||
return E.right(null);
|
||||
}
|
||||
|
||||
if (!(body instanceof File)) {
|
||||
return E.right(null);
|
||||
}
|
||||
|
||||
return E.right(body);
|
||||
}
|
||||
|
||||
return pipe(
|
||||
parseBodyEnvVariablesE(request.body.body, resolvedVariables),
|
||||
E.mapLeft((e) =>
|
||||
|
||||
Reference in New Issue
Block a user