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
Header redesign proposal #4415
Header redesign proposal #4415
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks highly promising!
* | ||
* - A value of type `A` which has a `Header[A]` in scope | ||
* - A (name, value) pair of `String`, which is treated as a `Recurring` header | ||
* - A `Header.Raw` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be a great place for an inline example.
* @param key name of the header to find | ||
* @return a scala.Option possibly containing the resulting [[org.http4s.Header]] | ||
*/ | ||
def get(key: CIString): Option[NonEmptyList[Header.Raw]] = headers.filter(_.name == key).toNel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be simpler to just return List[Header.Raw]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason I like Option[NonEmptyList
here, I think the emphasis is more on the fact that the header might not be present, and I'd imagine you'd want to do a bunch of getOrElse
, whereas it's not as easy to do onEmpty
on List
. Certainly up for debate though. Also the typed get
returns Option[NonEmptyList[A]]
for recurring headers, so there's some consistency there
This is looking great, we have had this pending for a really long time |
case _ => F.pure(None) | ||
else nope | ||
case _ => | ||
req.headers.get(CIString("Range")) match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where I'm thinking the Select machinery returning an Ior
might carry some weight. We have to handle headers that just vanish because they're invalid.
Header redesign proposal
Header redesign proposal
Header redesign proposal
Header redesign proposal
Header redesign proposal
Header redesign proposal
Header redesign proposal
Header redesign proposal
Header redesign proposal
[A: Header]
👍 ,HeaderT#Value
👎