vertx-web
vertx-web copied to clipboard
Open Api Service - Missing Form Attributes after Vert.x Update
We defined a Yaml Open Api 3.0 like the project description.
Problem
Missing expected form attributes, requests fails.
Reproduction
To reproduce the bug, please use my example project: webnobis-vertx-open-api2
Steps to reproduce
- Check out the example project
- To test with Vert.x 4.3.2, use the feature branch
- To test with Vert.x 4.3.0, use the master
- Execute the JUnit test, either with
./gradlew test
or within a IDE - Show log outputs
Behavior with Vert.x 4.3.2
After sending form attributes over the generated service, no form attributes exists, the request fails:
Junit-Test-Vert.x-4.3.2
______________Missing form attributes_______________ Unhandled exception in router io.vertx.ext.web.validation.BodyProcessorException: [Bad Request] Validation error for body application/x-www-form-urlencoded: provided object should contain property charset at io.vertx.ext.web.validation.BodyProcessorException.createValidationError(BodyProcessorException.java:64) ~[vertx-web-validation-4.3.2.jar:4.3.2] at io.vertx.ext.web.validation.impl.body.FormBodyProcessorImpl.lambda$process$0(FormBodyProcessorImpl.java:47)
Behavior with Vert.x 4.3.0
If we used Vert.x 4.3.0, the form attributes are available and the request is success:
JUnit-Test-Vert.x-4.3.0
______________Form attributes: id=the-id|content=the real content|charset=UTF-8 BUILD SUCCESSFUL in 1s
Log-Output-Implementation
do you think this might be related to what im seeing? https://github.com/vert-x3/vertx-web/issues/2220 . there doesn't seem to be a lot of throughput on bugs in this repo.
@chris-brace, yes, files fields are also form fields.
I found this days a workaround, to could use newer Vert.x versions also with the form fields:
// Overwrite Body handler, because of https://github.com/vert-x3/vertx-web/issues/2238 .map(RouterBuilder::mountServicesFromExtensions) .map(routerBuilder -> routerBuilder.rootHandler(BodyHandler.create())) .map(RouterBuilder::createRouter)
ooo thank you i will try this when i get some time
@webnobis this fixed it for me