Closed chen-kay closed 2 years ago
🐛 bug 描述 使用openapi生成FormData的请求时生成以下代码
/** 登录认证 POST /login */ export async function loginAccessTokenLoginPost( body: API.BodyLoginAccessTokenLoginPost, options?: { [key: string]: any }, ) { const formData = new FormData(); Object.keys(body).forEach((ele) => { const item = (body as any)[ele]; if (item !== undefined && item !== null) { formData.append( ele, typeof item === 'object' && !(item instanceof File) ? JSON.stringify(item) : item, ); } }); return request<API.LoginType>(`/api/v1/login`, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, data: formData, ...(options || {}), }); }
umi-request 构建 FormData 时,会自动构建Content-Type,添加该项会导致接口错误
FormData
Content-Type
fixed in https://github.com/chenshuai2144/openapi2typescript/issues/46
🐛 bug 描述 使用openapi生成FormData的请求时生成以下代码
umi-request 构建
FormData
时,会自动构建Content-Type
,添加该项会导致接口错误