Skip to content

Commit

Permalink
fix(h5): 兼容contentType一些奇怪的写法 (#1022)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qiu800820 authored and luckyadam committed Nov 7, 2018
1 parent 75cdfa1 commit 06b6b42
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/taro-h5/src/api/request/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export default function request (options) {
url = generateRequestUrlWithParams(url, options.data)
} else if (typeof options.data === 'object') {
let contentType = options.header && (options.header['Content-Type'] || options.header['content-type'])
if (contentType === 'application/json') {
if (contentType && contentType.indexOf('application/json') >= 0) {
params.body = JSON.stringify(options.data)
} else if (contentType === 'application/x-www-form-urlencoded') {
} else if (contentType && contentType.indexOf('application/x-www-form-urlencoded') >= 0) {
params.body = serializeParams(options.data)
} else {
params.body = options.data
Expand Down

0 comments on commit 06b6b42

Please sign in to comment.