Skip to content

WebFlux configuration must properly handle application/json #1047

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

Closed
gregturn opened this issue Aug 9, 2019 · 1 comment
Closed

WebFlux configuration must properly handle application/json #1047

gregturn opened this issue Aug 9, 2019 · 1 comment
Assignees
Milestone

Comments

@gregturn
Copy link
Contributor

gregturn commented Aug 9, 2019

When HATEAOS is activated, it seems to remove application/json, the default media type used by tools like WebTestClient. This can be irritating if you have controllers that do NOT deal with hypermedia yet seem to need a Content request header of application/hal+json.

@gregturn gregturn self-assigned this Aug 9, 2019
@gregturn gregturn added in: mediatypes Media type related functionality stack: webflux labels Aug 9, 2019
@gregturn gregturn added this to the 1.0.0.RC2 milestone Aug 9, 2019
gregturn added a commit that referenced this issue Aug 9, 2019
Spring HATEAOS must be strict in what it registers, thus NOT use WebFlux's defaults. Yet it should register at least it's HAL-based media types for application/json, the default type used by testing toolkits such as WebTestClient. That way, if you craft a controller that does not deal with hypermedia, it will function as expected.

That is why I've expanded HypermediaMappingInformation to include a `getRegisterableMediaTypes` method. By default, it simply returns the results of `getMediaTypes`. But certain media types, like HAL and HAL-FORMS, can add `application/json` as a media type they will respond to if asked. This provides the means to support other formats using the same serializers.
gregturn added a commit that referenced this issue Sep 4, 2019
Spring WebFlux now correctly handles custom codecs. This means we can stop disabling them. This change includes more test cases, verifying Spring MVC configuration for hypermedia as well, verifying both Web MVC and WebFlux are properly and consistently configured.

Probably supercedes: #1047
@gregturn
Copy link
Contributor Author

gregturn commented Sep 4, 2019

Superceded by #1061.

@gregturn gregturn closed this as completed Sep 5, 2019
gregturn added a commit that referenced this issue Sep 5, 2019
With Spring WebFlux properly handling custom codecs, no need to disable the default handlers.

This commit verifies WebFlux configuration in test cases, and also adds an equivalent set of test cases verifying Web MVC configuration as well.

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

No branches or pull requests

1 participant