Skip to content

Commit

Permalink
fix: request file
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed Nov 30, 2018
1 parent 56a03a0 commit 7b2e4d4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,14 @@ export default function request<T extends RequestOptions>(options: T): Promise<{
header: options.header,
formData: options.data,
success: res => {
let data = res.data
if (options.responseDataType === 'json') {
try {
data = JSON.parse(data)
} catch (e) {}
}
resolve({
data: res.data,
data: data,
status: res.statusCode,
})
},
Expand Down

0 comments on commit 7b2e4d4

Please sign in to comment.