Skip to content

Commit

Permalink
fix: request
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed Dec 2, 2018
1 parent b10b78b commit 38a4831
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ export default function request<T extends RequestOptions>(options: T): Promise<{
})

// 设置 Content-Type
options.header['Content-Type'] = options.header['Content-Type'] || (
file ? 'multipart/form-data' : requestDataTypeToContentType[options.requestDataType]
)
if (file) {
delete options.header['Content-Type']
} else {
options.header['Content-Type'] = options.header['Content-Type'] || requestDataTypeToContentType[options.requestDataType]
}

// 小程序请求
if (inWechatMiniProgram()) {
Expand Down

0 comments on commit 38a4831

Please sign in to comment.