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

Problem documenting response with custom status code with WebTestClient #847

Closed
LorenzoLuconi opened this issue Oct 11, 2022 · 1 comment
Assignees
Labels
Milestone

Comments

@LorenzoLuconi
Copy link

Hi,

The problem should be fixed in version 2.0.4 #639 , but I have the same problem with 2.0.6 version using webtestclient.
The released fix is also valid for webtestaclient?

java.lang.IllegalArgumentException: No matching constant for [210]

at org.springframework.http.HttpStatus.valueOf(HttpStatus.java:547)
at org.springframework.mock.http.client.reactive.MockClientHttpResponse.getStatusCode(MockClientHttpResponse.java:71)
at org.springframework.http.client.reactive.ClientHttpResponseDecorator.getStatusCode(ClientHttpResponseDecorator.java:60)
at org.springframework.test.web.reactive.server.ExchangeResult.getStatus(ExchangeResult.java:176)
at org.springframework.restdocs.webtestclient.WebTestClientResponseConverter.convert(WebTestClientResponseConverter.java:39)
at org.springframework.restdocs.webtestclient.WebTestClientResponseConverter.convert(WebTestClientResponseConverter.java:35)
at org.springframework.restdocs.generate.RestDocumentationGenerator.handle(RestDocumentationGenerator.java:187)
at org.springframework.restdocs.webtestclient.WebTestClientRestDocumentation.lambda$document$0(WebTestClientRestDocumentation.java:77)
at org.springframework.test.web.reactive.server.DefaultWebTestClient$DefaultBodyContentSpec.lambda$consumeWith$3(DefaultWebTestClient.java:709)
at org.springframework.test.web.reactive.server.ExchangeResult.assertWithDiagnostics(ExchangeResult.java:231)

Thanks,
Lorenzo

@wilkinsona
Copy link
Member

#639 was specifically for MockMvc as WebTestClient didn't provide access to the status in its raw form at that time. Thing should have improved by now so hopefully a similar fix can now be made for WebTestClient.

@wilkinsona wilkinsona changed the title Problem documenting response with custom status code with webtestclient Problem documenting response with custom status code with WebTestClient Oct 11, 2022
@wilkinsona wilkinsona added type: bug A bug and removed status: waiting-for-triage Untriaged issue labels Oct 11, 2022
@wilkinsona wilkinsona modified the milestones: 2.0.x, 2.0.7.RELEASE Oct 11, 2022
@wilkinsona wilkinsona self-assigned this Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants