Cleaner API for HTTP headers
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 35.1k
- Forks
- 16.3k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 143
Description
I see the vast number of methods for getting various typed values out of HttpHeaders as dates, numbers, etc. (maybe these are new-ish? I don't remember them from when I was writing Acteur).
I see what you're trying to do here, but it seems clunky. A pattern similar to what you have for ChannelOption<T> would be cleaner and less bug-prone. For example, a Vary header's value type ought to be a list of kinds of headers - and so forth. And having the API make it difficult to use an inappropriate type is a plus.
It happens that I have such an API in Acteur. It wouldn't take many changes to port that to Netty's codebase - I'd just have to remove the dependency on Joda Time. Typical code in Acteur looks like:
add ( Headers.IF_MODIFIED_SINCE, DateTime.now() );
add ( Headers.AGE, Duration.standardDays ( 2 ) );
// and non-standard headers
add( Headers.stringHeader ( "X-foo" ), "foo" );
Here's the package with that API and the base type for Header types and the collection of built-in headers
If you think this would be interesting, let me know.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting Netty's current HttpHeaders API and the existing ChannelOption pattern mentioned in the issue. Compare those with the linked Acteur HeaderValueType and Headers implementations, then clarify the intended typed-header scope, dependency constraints, and acceptance criteria before attempting work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100