Bläddra i källkod

Update serializer

Use constants in enctype.
master
TheoryOfNekomata 1 år sedan
förälder
incheckning
00a3ee5d07
1 ändrade filer med 2 tillägg och 2 borttagningar
  1. +2
    -2
      packages/iceform-next/src/utils/serialization.ts

+ 2
- 2
packages/iceform-next/src/utils/serialization.ts Visa fil

@@ -1,7 +1,7 @@
import { IncomingMessage } from 'http';
import { getFormValues } from '@theoryofnekomata/formxtra';
import {
ENCTYPE_APPLICATION_JSON,
ENCTYPE_APPLICATION_JSON, ENCTYPE_APPLICATION_OCTET_STREAM,
ENCTYPE_MULTIPART_FORM_DATA,
ENCTYPE_X_WWW_FORM_URLENCODED,
} from '../common';
@@ -66,7 +66,7 @@ export const DEFAULT_ENCTYPE_DESERIALIZERS: EncTypeDeserializerMap = {

export const deserializeBody = async (params: DeserializeBodyParams) => {
const { req, deserializers = DEFAULT_ENCTYPE_DESERIALIZERS } = params;
const contentType = req.headers['content-type'] ?? 'application/octet-stream';
const contentType = req.headers['content-type'] ?? ENCTYPE_APPLICATION_OCTET_STREAM;

if (contentType?.startsWith(`${ENCTYPE_MULTIPART_FORM_DATA};`)) {
return parseMultipartFormData(req);


Laddar…
Avbryt
Spara