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

Support q-factor weighting in Accept header #5966

Closed
nflaig opened this issue Sep 18, 2023 · 0 comments · Fixed by #6014
Closed

Support q-factor weighting in Accept header #5966

nflaig opened this issue Sep 18, 2023 · 0 comments · Fixed by #6014
Labels
meta-feature-request Issues to track feature requests.

Comments

@nflaig
Copy link
Member

nflaig commented Sep 18, 2023

Problem description

At the moment, Lodestar does not support q-factor weighting in Accept header values.

The following value results in JSON response but it should be SSZ due to higher weight

application/octet-stream;q=1,application/json;q=0.9

The reason for this is that a strict equality check is used on the raw header value to determine the response type and if the value does not exactly match application/octet-stream is will always send a JSON response.

parseReq: ({params, headers}) => [params.state_id, headers.accept === mimeTypeSSZ ? "ssz" : "json"],

This can cause issues when using attestantio client as fetching the state as JSON is a lot slower and without increasing the max heap limit will crash Lodestar for a lot of networks, e.g. mainnet or holesky.

Solution description

Support q-factor weighting in Accept header

Additional context

@nflaig nflaig added the meta-feature-request Issues to track feature requests. label Sep 18, 2023
jshufro added a commit to jshufro/lodestar that referenced this issue Oct 1, 2023
jshufro added a commit to jshufro/lodestar that referenced this issue Oct 2, 2023
jshufro added a commit to jshufro/lodestar that referenced this issue Oct 2, 2023
jshufro added a commit to jshufro/lodestar that referenced this issue Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta-feature-request Issues to track feature requests.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant