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

Unexpected end of form #59

Open
lucrus73 opened this issue Jan 25, 2023 · 1 comment
Open

Unexpected end of form #59

lucrus73 opened this issue Jan 25, 2023 · 1 comment

Comments

@lucrus73
Copy link

lucrus73 commented Jan 25, 2023

I'm trying to add a file upload endpoint, using Multer, but the same goes for others choices too (express-fileupload and raw busboy). I get 'Unexpected end of form' when trying the endpoint from Swagger.

Up until now I took for granted it was my code to blame, but now I suspect it might have something to do with the scaffolded code from this project.

Here is my question at StackOverlow, which has all the details, and here is a minimal reproducible example of the problem.

@lucrus73
Copy link
Author

lucrus73 commented Jan 26, 2023

Changing this line of generated code in server.ts from:

ignorePaths: /.*\/spec(\/|$)/,

to

ignorePaths: (path: string) => path.endsWith('/spec') || path.indexOf('/upload') >= 0,

(where /api/v1/upload is the endpoint I added for file uploads) does work around the problem, which suggests the validator is to blame. I can live without validating file uploads, but it's not an acceptable solution in general.

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