Skip to content

Commit

Permalink
Merge pull request #6 from misaka-ink/dev
Browse files Browse the repository at this point in the history
support specified accept method
  • Loading branch information
SmilingXinyi committed Mar 20, 2020
2 parents f86a398 + 51be3f4 commit e05d295
Show file tree
Hide file tree
Showing 5 changed files with 2,875 additions and 997 deletions.
2 changes: 2 additions & 0 deletions lib/fetch2.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ export default class fetch2 {
const contentType = response.headers.get("content-type")
if (contentType && contentType.indexOf("application/json") !== -1) {
return response.json()
} else if(ctx._options.acceptFuncName) {
return response[ctx._options.acceptFuncName]();
} else {
return response.text()
}
Expand Down
Loading

0 comments on commit e05d295

Please sign in to comment.