-
Notifications
You must be signed in to change notification settings - Fork 595
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
Create a 'strictEntity' directive #26
Comments
Comment by ktoso Thanks for the ticket, I agree it's better to provide a directive whcih does this "safely" than assuming people will do the right thing (and get 20 "almost correct" impls ;-)) |
Comment by ktoso PRs very welcome to this one, should be rather simple :) |
Comment by Hawstein @Joe-Edwards @ktoso I will work on this if you don't mind. And AFAICS, just adding a |
Comment by Joe-Edwards Go for it. If it's any help, what I'd come up with so far was:
I'm not sure if the optimization in the strict case is really necessary (perhaps using FastFuture will make it redundant anyway?) |
Comment by ktoso The optimisation is not needed, toStrict does the right thing (returns "this") if the entity is Strict already. I was more thinking of making a directive that works via mapRequest, i.e. it transforms the entity transparently. strictEntity { // toStricts, but we can do various things inside
extractDataBytes { // works since strict already
// ..
} ~ get {
extractRequest { r => r.entity.dataBytes .... }
}
} |
Comment by ktoso For inspiration look at
|
Comment by Joe-Edwards The benefit of extracting the entity is that you get don't need to match/cast it. Usually you want a strict entity so you can get the data explicitly:
vs
|
Comment by ktoso Sure, however it does not compose as nicely. I stand by the need of doing a directive like I proposed, and optionally adding a |
Was this not already implemented by akka/akka#20953? |
Correct, thanks a lot for noticing @catalin-ursachi ! |
Duplicate of akka/akka#20881 (already solved) |
Issue by Joe-Edwards
Tuesday Jul 05, 2016 at 09:45 GMT
Originally opened as akka/akka#20881
From #20850
A
Directive1[HttpEntity.Strict]
which calls toStrict on the HTTP Entity safely with a specified timeout (to avoid the deadlock in the other ticket). N.B. should also replace the entity in the request context.The text was updated successfully, but these errors were encountered: