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

In extractStrictEntity also change request to contain that strict entity for inner routes #961

Closed
jrudolph opened this issue Mar 14, 2017 · 2 comments
Labels
help wanted Identifies issues that the core team will likely not have time to work on t:routing Issues related to the routing DSL t:stream
Milestone

Comments

@jrudolph
Copy link
Member

Currently, extractStrictEntity runs toStrict on the request entity and passes it to the inner route. However, if the inner route tries to access the now drained entity again, the route fails. Instead, we can also rewrite the request in the requestContext to contain the now strict entity. This way inner routes can safely access the entity.

This doesn't fix #73 (i.e. route alternatives will still fail when accessing the entity) but might still be a user experience improvement.

@jrudolph jrudolph added 1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted help wanted Identifies issues that the core team will likely not have time to work on t:routing Issues related to the routing DSL t:stream labels Mar 14, 2017
@jrudolph
Copy link
Member Author

Basically, it can then be implemented as something like

`toStrictEntity(timeout) & extract(_.request.entity.asInstanceOf[HttpEntity.Strict])

jonas added a commit to jonas/akka-http that referenced this issue Mar 19, 2017
…r routes

Use toStrictEntity so the request is updated to provide the strict
entity for inner routes ensuring that the request data is only read
once.
@jonas jonas added 3 - in progress Someone is working on this ticket and removed 1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted labels Mar 21, 2017
jonas added a commit to jonas/akka-http that referenced this issue Mar 28, 2017
…r routes

Use toStrictEntity so the request is updated to provide the strict
entity for inner routes ensuring that the request data is only read
once.
jonas added a commit that referenced this issue Mar 29, 2017
…utes

Use toStrictEntity so the request is updated to provide the strict
entity for inner routes ensuring that the request data is only read
once.
@jonas jonas removed the 3 - in progress Someone is working on this ticket label Mar 29, 2017
@jonas jonas added this to the 10.0.6 milestone Mar 29, 2017
@jonas
Copy link
Member

jonas commented Mar 29, 2017

Fixed in 938f626

@jonas jonas closed this as completed Mar 29, 2017
tomrf1 pushed a commit to tomrf1/akka-http that referenced this issue Aug 13, 2017
…r routes

Use toStrictEntity so the request is updated to provide the strict
entity for inner routes ensuring that the request data is only read
once.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Identifies issues that the core team will likely not have time to work on t:routing Issues related to the routing DSL t:stream
Projects
None yet
Development

No branches or pull requests

2 participants