-
Notifications
You must be signed in to change notification settings - Fork 736
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
Pretty printing truncates non-json responses that happen to begin with valid json #730
Comments
This only seems to happen if the first line contains only a valid number. |
The response snippet should just use the body as-is so the nature of the content shouldn’t make any difference. The content length and body content are also in agreement so I’m not sure why it’s apparently being truncated. It’s possible that the cause lies somewhere before REST Docs gets involved. To help with figuring out what’s going on, please provide a minimal sample that reproduces the problem. |
Found it: @Override
public void customize(MockMvcRestDocumentationConfigurer configurer) {
configurer.operationPreprocessors().withResponseDefaults(prettyPrint());
} It uses the What's the best way to work around this for a single test? |
Thanks for tracking down the cause. I think your best bet for now may be to decorate the pretty-printer with something that checks the content type. Something like this, with changes to the media type compatibility checks to meet your needs:
You can then use |
The simplest fix for this would be to set |
The following test passes
But
example/http-response.snippet
only has:spring-restdocs-mockmvc 2.0.5.RELEASE
The text was updated successfully, but these errors were encountered: