fix: fix issue for multipart/form-data and cookie header (#4172)
* fix(multipart-formdata): fix type for data variable * fix(multipart-formdata): fix parameter filter for unsetted file * fix(multipart-formdata): add mime type for sending file * fix(multipart-formdata): add application/octet-stream by default mimetype * fix(multipart-formdata): remove content-type: multipart/form-data header * fix(multipart-formdata): remove cookie cookie header if not present * fix(multipart-formdata): fix content-type filter --------- Co-authored-by: Dmitry Mukovkin <d.mukovkin@cft.ru>
This commit is contained in:
@@ -320,7 +320,13 @@ function getFinalBodyFromRequest(
|
||||
if (request.body.contentType === "multipart/form-data") {
|
||||
return pipe(
|
||||
request.body.body ?? [],
|
||||
A.filter((x) => (x.key !== "" || x.isFile) && x.active), // Remove empty keys
|
||||
A.filter(
|
||||
(x) =>
|
||||
x.key !== "" &&
|
||||
x.active &&
|
||||
(typeof x.value === "string" ||
|
||||
(x.value.length > 0 && x.value[0] instanceof File))
|
||||
), // Remove empty keys and unsetted file
|
||||
|
||||
// Sort files down
|
||||
arraySort((a, b) => {
|
||||
|
||||
Reference in New Issue
Block a user