浏览代码

Update serializer

Use constants in enctype.
master
父节点
当前提交
00a3ee5d07
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. +2
    -2
      packages/iceform-next/src/utils/serialization.ts

+ 2
- 2
packages/iceform-next/src/utils/serialization.ts 查看文件

@@ -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);


正在加载...
取消
保存