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

UnsupportedRequestContentTypeRejection formats error messages not in a user-friendly way #2804

Closed
satorg opened this issue Nov 6, 2019 · 3 comments

Comments

@satorg
Copy link
Contributor

@satorg satorg commented Nov 6, 2019

If a request is rejected with UnsupportedRequestContentTypeRejection and actual contentType is provided to the rejection, then the error message for this rejection will look like the following:

The request's Content-Type [Some(Some(image/gif))] is not supported. Expected:\nimage/jpeg or image/png

which is not user-friendly.

The reason is in these two lines:
https://github.com/akka/akka-http/blob/v10.1.10/akka-http/src/main/scala/akka/http/scaladsl/server/RejectionHandler.scala#L265-L266

The unsupportedContentType value has got type Option[Option[ContentType]].

@raboof

This comment has been minimized.

Copy link
Member

@raboof raboof commented Nov 7, 2019

That indeed could be better. Would you be interested in improving this?

@satorg

This comment has been minimized.

Copy link
Contributor Author

@satorg satorg commented Nov 8, 2019

Yes, for sure. I have shot a tiny PR for this issue (#2807), could you take a look, please?

jrudolph added a commit that referenced this issue Nov 18, 2019
http: fix default rejection message for unsupported content type (#2804)
@jrudolph jrudolph added this to the 10.1.11 milestone Nov 18, 2019
@jrudolph

This comment has been minimized.

Copy link
Member

@jrudolph jrudolph commented Nov 18, 2019

Fixed in #2807.

@jrudolph jrudolph closed this Nov 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.