emanualjade / test-openapi

Automatic API integration testing
MIT License
14 stars 4 forks source link

Support OpenAPI specification with `consumes` property `undefined` #2

Closed jpettit closed 6 years ago

jpettit commented 6 years ago

I found that when the content type is not defined - I'm hitting the following:

This resolved the issue for me.

OS: darwin
node.js: v10.11.0
test-openapi: 38.1.1

TypeError: Cannot read property 'filter' of undefined
    at removeFormDataMimes (/Users/jpettit/dev/github/test-openapi/src/core/spec/start/normalize/form_data.js:32:24)
    at filterFormDataMimes (/Users/jpettit/dev/github/test-openapi/src/core/spec/start/normalize/form_data.js:11:10)
    at getContentTypeParam (/Users/jpettit/dev/github/test-openapi/src/core/spec/start/normalize/content_negotiation.js:21:21)
    at getNegotiationsParams (/Users/jpettit/dev/github/test-openapi/src/core/spec/start/normalize/content_negotiation.js:7:23)
    at getParams (/Users/jpettit/dev/github/test-openapi/src/core/spec/start/normalize/params/main.js:24:31)
    at getOperation (/Users/jpettit/dev/github/test-openapi/src/core/spec/start/normalize/main.js:34:18)
    at Object.entries.map (/Users/jpettit/dev/github/test-openapi/src/core/spec/start/normalize/main.js:27:5)
    at Array.map (<anonymous>)
    at getOperationsByPath (/Users/jpettit/dev/github/test-openapi/src/core/spec/start/normalize/main.js:26:35)
    at Object.entries.map (/Users/jpettit/dev/github/test-openapi/src/core/spec/start/normalize/main.js:16:5)
jpettit commented 6 years ago

@ehmicky - could you take a look?

ehmicky commented 6 years ago

Thanks a lot for this PR. This is a bug indeed, and your PR solves it. See my few comments.

jpettit commented 6 years ago

@ehmicky - should be ready, let me know if you'd like me to rebase my commits into a single commit

ehmicky commented 6 years ago

Thanks again!