feat!: add ContentType, expanded Accept parsing#6
Conversation
37a7201 to
888f5a9
Compare
BREAKING CHANGES
* ContentType{} to describe a full content type descriptor
* ParseAccept() returns a slice of acceptable ContentTypes found, ordered by
quality factor
* ParseContentType() returns (ContentType, bool)
* CheckFormat() returns a single, preferred ContentType
* Remove spaces from default ContentType formatting
* Deprecate ResponseContentTypeHeader
* Deprecate RequestAcceptHeader
d9f0719 to
83d1e83
Compare
| DefaultOrder = ContentTypeOrderDfs // The default value for an unspecified "order" parameter. | ||
|
|
||
| ContentTypeOrderDfs ContentTypeOrder = "dfs" | ||
| ContentTypeOrderUnk ContentTypeOrder = "unk" |
There was a problem hiding this comment.
is this a useful value? we don't seem to do anything with an unknown ordering, and if the ordering is anything other than an understood 'dfs' we presumably would want to stream it through unchanged rather than try to change it to "unk"? since we'd be comparing against known values, like 'dfs', what do we get by defining and parsing an 'unk' value here?
There was a problem hiding this comment.
It's defined by the spec https://specs.ipfs.tech/http-gateways/trustless-gateway/#car-order-content-type-parameter
I'm not particularly a fan of this existing but but the idea of it being in here is that a consumer of this library can decide what to do with it. Currently Lassie will ignore it and assume dfs and error on you for feeding bad data. Frisbii will always give you dfs regardless of what you ask for (on the assumption that dfs is a subset of unk so this is acceptable).
This isn't new btw, it was in Lassie like this; no behaviour should be changing with this, it just gets surfaced as a parameter you can inspect now if you care.
There was a problem hiding this comment.
it does seem like premature complexity / over engineering
There was a problem hiding this comment.
It was nearly dfs, rnd, weak!
Our approach atm is to 🙈; although it's at least exposed here if you actually wanted to do something with it. I'm going to assume that nobody will that wants to interoperate with our current tools (Lassie primarily).
83d1e83 to
d5b02bc
Compare
BREAKING CHANGES