Skip to content

Commit c90f671

Browse files
committed
MOAR formData
1 parent 226bd2b commit c90f671

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/execute.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,18 @@ export function buildRequest({
175175
// only attach body if the requestBody has a definition for the
176176
// contentType that has been explicitly set
177177
if (requestContentType === 'application/x-www-form-urlencoded') {
178-
req.form = requestBody
178+
if (typeof requestBody === 'object') {
179+
req.form = {}
180+
Object.keys(requestBody).forEach((k) => {
181+
const val = requestBody[k]
182+
req.form[k] = {
183+
value: val
184+
}
185+
})
186+
}
187+
else {
188+
req.form = requestBody
189+
}
179190
}
180191
else {
181192
req.body = requestBody
@@ -187,6 +198,7 @@ export function buildRequest({
187198
}
188199
}
189200

201+
190202
// Add securities, which are applicable
191203
// REVIEW: OAS3: what changed in securities?
192204
req = applySecurities({request: req, securities, operation, spec})

0 commit comments

Comments
 (0)