Vapor supports some nice hard-typed APIs that let users interact with some header fields in a convenient manner.
For example, consider the following:
import Vapor /// `Vapor` exports `NIOHTTP1`
var headers = NIOHTTP1.HTTPHeaders()
headers.contentType = HTTPMediaType.json
This feature requests asks if such a feature can be supported by swift-http-types itself, instead of us having to implement it in each of HTTP-server packages such as Hummingbird (v2 is WIP and uses swift-http-types) or Vapor (in v5, the work has not yet begun but it's clear we'll be using swift-http-types).
My understanding is that a package like this would want to be very conservative about adding a feature like this, but I still think such convenient APIs are very valuable.
As i see it, one of the followings should be the case about this feature request, so I'm interested to know which one:
- In scope, can be supported.
- Not a main feature, maybe it can be in an e.g.
HTTPTypesExtras target, or package.
- Completely out of scope, will not be supported.
This is how vapor implements such a feature for the content-type header.
Note that content-type is just an example. There could be many more header field names supported with an API like this.
Vapor supports some nice hard-typed APIs that let users interact with some header fields in a convenient manner.
For example, consider the following:
This feature requests asks if such a feature can be supported by
swift-http-typesitself, instead of us having to implement it in each of HTTP-server packages such as Hummingbird (v2 is WIP and usesswift-http-types) or Vapor (in v5, the work has not yet begun but it's clear we'll be usingswift-http-types).My understanding is that a package like this would want to be very conservative about adding a feature like this, but I still think such convenient APIs are very valuable.
As i see it, one of the followings should be the case about this feature request, so I'm interested to know which one:
HTTPTypesExtrastarget, or package.This is how vapor implements such a feature for the
content-typeheader.Note that
content-typeis just an example. There could be many more header field names supported with an API like this.