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

Handle null content type as if the header was not set #8772

Merged
merged 1 commit into from Nov 7, 2018

Conversation

Projects
None yet
4 participants
@marcospereira
Copy link
Member

marcospereira commented Nov 6, 2018

Fixes

Fixes #8713.

Purpose

When calling Result.as or HttpEntity.as with a null value, it later fails when doing the model conversion to the server backend. Since the content type can be configured as an Option/Optional, it makes sense to handle null values as None and, instead of failing, just return the response without the header.

@FranklinYinanDing

This comment has been minimized.

Copy link
Contributor

FranklinYinanDing commented Nov 7, 2018

Thanks for the fix! Looks good to me!

@dwijnand
Copy link
Member

dwijnand left a comment

Seems reasonable to me!

@dwijnand dwijnand merged commit 56014d2 into playframework:master Nov 7, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
typesafe-cla-validator All users have signed the CLA
Details

@marcospereira marcospereira deleted the marcospereira:fix-8713-fix-http-entity-null-content-type branch Nov 7, 2018

marcospereira added a commit that referenced this pull request Nov 27, 2018

Handle null content type as if the header was not set (#8772)
Fixes #8713.

When calling `Result.as` or `HttpEntity.as` with a `null` value, it later fails when doing the model conversion to the server backend. Since the content type can be configured as an `Option`/`Optional`, it makes sense to handle null values as `None` and, instead of failing, just return the response without the header.
@marcospereira

This comment has been minimized.

Copy link
Member

marcospereira commented Nov 27, 2018

Backport to 2.6.x: 639002b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment