Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled exception in swagger_params_parser.js #100

Open
szilveszterb opened this issue Apr 28, 2017 · 0 comments
Open

Unhandled exception in swagger_params_parser.js #100

szilveszterb opened this issue Apr 28, 2017 · 0 comments

Comments

@szilveszterb
Copy link

I'm using swagger-express-mw v0.7.0 with swagger.
I have an endpoint consuming content type multipart/form-data and it has a parameter with type file.

If I do a POST to that endpoint with content type multipart/form-data and I deliberately omit the file as a test, then an Exception is thrown from the getValue function in swagger_params_parser.js, line 40:

params[parameter.name] = parameter.getValue(req); // note: we do not check for errors here

In that case next() is never called.

A try - catch around that code would solve the issue.
Let me know if this was an acceptable solution.

The error log:

Error: req.files must be provided for 'formData' parameters of type 'file'
at Parameter.getValue (/Users/szilveszterb/work/projects/murano/okami_api/node_modules/sway/lib/types/parameter.js:141:15)
at /Users/szilveszterb/work/projects/murano/okami_api/node_modules/swagger-node-runner/fittings/swagger_params_parser.js:40:44
at Array.forEach (native)
at /Users/szilveszterb/work/projects/murano/okami_api/node_modules/swagger-node-runner/fittings/swagger_params_parser.js:39:46
at finishedParseBody (/Users/szilveszterb/work/projects/murano/okami_api/node_modules/swagger-node-runner/fittings/swagger_params_parser.js:128:12)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant