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
Multipart decoding using EntityDecoder #2821
Multipart decoding using EntityDecoder #2821
Conversation
I think this is neat.
@ChristopherDavenport has long advocated for a typeclass approach to Message
, and I'm guessing he won't like this. But the concept of Media
might be a typeclass for which Request
and Response
and Part
have instances.
I think the typeclass approach may be still compelling, but this makes a currently awkward thing less awkward, so I like it.
I'm so numb to the flaky tests that I didn't notice there's a tut failure here. We would need to clean that up first. |
Fixed |
Leaving a message that this concept digs further into a well I'm uncomfortable with. This is more unbound inheritance. Making it harder to go the other direction.
@ChristopherDavenport another approach (without resorting to inheritance) would be to make |
#1572 represents the typeclass approach. The diff is unfortunately difficult to read after I did something catastrophically stupid while working on docs, but the comments show the mostly pros and a few unresolved cons. I also think the typeclass approach might help with things like AuthedRequest, which I don't think was appreciated during the discussion of #1572. I think the alternative to this PR is to have In either case, it would be nice if we had something that works for |
Not sure if I like the (lawless) typeclass approach, tbh. |
Would be nice to decide on this before 0.21 final, but are just looking at a milestone today. |
I think this is reasonable and we should add this. |
Between the two styles proposed, I come down on the side of working code. Someone can try the typeclass proposal after 0.21.
This PR is an attempt to improve multipart decoding by allowing to use
EntityDecoder
on aPart[F]
:Media[F]
which is implemented byMessage[F]
andPart[F]
;EntityDecoder.decode
now accepts aMedia[F]
instead ofMessage[F]
.