Skip to content

Commit de644f9

Browse files
committed
WIP
1 parent 2a3f113 commit de644f9

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

src/execute/index.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export function buildRequest(options) {
102102
}
103103

104104
// Base Template
105-
const req = {
105+
let req = {
106106
url: baseUrl({spec, scheme, contextUrl, server, serverVariables}),
107107
credentials: 'same-origin',
108108
headers: {
@@ -191,11 +191,18 @@ export function buildRequest(options) {
191191
const versionSpecificOptions = {...options, operation}
192192

193193
if (specIsOAS3) {
194-
return oas3BuildRequest(versionSpecificOptions, req)
194+
req = oas3BuildRequest(versionSpecificOptions, req)
195195
}
196+
else {
197+
// If not OAS3, then treat as Swagger2.
198+
req = swagger2BuildRequest(versionSpecificOptions, req)
199+
}
200+
201+
// Will add the query object into the URL, if it exists
202+
// ... will also create a FormData instance, if multipart/form-data (eg: a file)
203+
mergeInQueryOrForm(req)
196204

197-
// If not OAS3, then treat as Swagger2.
198-
return swagger2BuildRequest(versionSpecificOptions, req)
205+
return req
199206
}
200207

201208
const stripNonAlpha = str => (str ? str.replace(/\W/g, '') : null)

src/execute/oas3/style-serializer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function encodeArray({key, value, style, explode}) {
2323
if (!prev || explode) {
2424
return `${(prev || '')};${key}=${curr}`
2525
}
26-
return prev + `,${curr}`
26+
return `${prev},${curr}`
2727
}, '')
2828
}
2929
if (style === 'form') {

src/execute/swagger2/build-request.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ export default function (options, req) {
3535
}
3636
}
3737

38-
// Will add the query object into the URL, if it exists
39-
// ... will also create a FormData instance, if multipart/form-data (eg: a file)
40-
mergeInQueryOrForm(req)
41-
4238
return req
4339
}
4440

test/oas3/execute/style-explode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const petstoreSpec = jsYaml.safeLoad(fs.readFileSync(path.join('test', 'oas3', '
1111
// Supported shape... { spec, operationId, parameters, securities, fetch }
1212
// One can use operationId or pathItem + method
1313

14-
describe.skip('buildRequest w/ `style` & `explode` - OpenAPI Specification 3.0', function () {
14+
describe('buildRequest w/ `style` & `explode` - OpenAPI Specification 3.0', function () {
1515
describe('path parameters', function () {
1616
describe('primitive values', function () {
1717
it('default: should build a path parameter in a simple/no-explode format', function () {

test/swagger2/execute/apply-securities.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import expect from 'expect'
2-
import { applySecurities } from '../../../src/execute/swagger2/build-request'
2+
import {applySecurities} from '../../../src/execute/swagger2/build-request'
33

44
describe('swagger2 - execute - applySecurities', function () {
55
it('should NOT add any securities, if the operation does not require it', function () {

0 commit comments

Comments
 (0)