Skip to content

Commit

Permalink
fix form requests
Browse files Browse the repository at this point in the history
  • Loading branch information
chregu committed Oct 29, 2020
1 parent 8b3677a commit 080ea10
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,12 @@ export default (config = {}) => {
retryDelay
}
if (options.form === true) {
request.form = payload || {}
const formData = payload || {}
const requestData = new FormData()
Object.keys(formData).forEach(function (meta) {
requestData.append(meta, formData[meta])
})
request.body = requestData
} else if (options.multipart !== true) {
request.json = true
request.body = payload
Expand Down

0 comments on commit 080ea10

Please sign in to comment.