Skip to content
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

bug: accept header vs format query param precedence #458

Closed
SgtPooki opened this issue Jan 22, 2024 · 0 comments · Fixed by #459
Closed

bug: accept header vs format query param precedence #458

SgtPooki opened this issue Jan 22, 2024 · 0 comments · Fixed by #459
Assignees
Labels
dif/medium Prior experience is likely helpful effort/hours Estimated to take one or several hours P2 Medium: Good to have, but can wait until someone steps up

Comments

@SgtPooki
Copy link
Member

SgtPooki commented Jan 22, 2024

### `format` (request query parameter)
Optional, `format=<format>` can be used to request specific response format.
This is a URL-friendly alternative to sending an [`Accept`](#accept-request-header) header.
These are the equivalents:
- `format=raw``Accept: application/vnd.ipld.raw`
- `format=car``Accept: application/vnd.ipld.car`
- `format=tar``Accept: application/x-tar`
- `format=dag-json``Accept: application/vnd.ipld.dag-json`
- `format=dag-cbor``Accept: application/vnd.ipld.dag-cbor`
- `format=json``Accept: application/json`
- `format=cbor``Accept: application/cbor`
- `format=ipns-record``Accept: application/vnd.ipfs.ipns-record`

We should clarify which takes precedence. Adin pointed me to https://github.com/ipfs/boxo/blob/4c3a1f2f343637b615c26a27a55afa12dd5aaed5/gateway/handler.go#L620-L621 which says Accept header should take priority.

// First, inspect Accept header, as it may not only include content type, but also optional parameters.
// such as CAR version or additional ones from IPIP-412.

@hacdias hacdias added P2 Medium: Good to have, but can wait until someone steps up dif/medium Prior experience is likely helpful effort/hours Estimated to take one or several hours labels Jan 23, 2024
lidel added a commit that referenced this issue Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dif/medium Prior experience is likely helpful effort/hours Estimated to take one or several hours P2 Medium: Good to have, but can wait until someone steps up
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants