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

PE-4908 Add support for range requests #64

Merged
merged 4 commits into from
Nov 27, 2023

Conversation

djwhitt
Copy link
Collaborator

@djwhitt djwhitt commented Nov 22, 2023

Adds support for range requests excluding requests for multiple ranges which are currently handled by returning 200 (rather than 206) with full data in the body. Multiple ranges will be fully supported once we've integrated range handling into getData.

Copy link

codecov bot commented Nov 22, 2023

Codecov Report

Attention: 46 lines in your changes are missing coverage. Please review.

Comparison is base (7efe274) 56.56% compared to head (753c5b9) 57.72%.

Files Patch % Lines
src/routes/data/handlers.ts 65.41% 46 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #64      +/-   ##
===========================================
+ Coverage    56.56%   57.72%   +1.16%     
===========================================
  Files           18       18              
  Lines         5164     5280     +116     
  Branches       244      260      +16     
===========================================
+ Hits          2921     3048     +127     
+ Misses        2241     2228      -13     
- Partials         2        4       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pescennius and others added 3 commits November 27, 2023 09:42
- Reduces duplicated header logic.
- Replaces custom range parsing code with the range-parser library in
  order to handle the full range parsing spec.
- Handles range errors case (malformed, unsatisfiable range) with
  appropriate status codes.
- Responds to requests for multiple ranges with 200 and full data (we're
  not yet supporting multiple ranges).

Multiple ranges will be fully supported once we've integrated range
handling into `getData`. In the meantime we should watch out for clients
that get confused by how we're currently handling them.
Adds some basic range requets tests to ensure that the expected range
data is returned and requests for multiple ranges are responded to with
a 200 + full data.
@djwhitt djwhitt force-pushed the PE-4908-range-request-integration branch from 9f80b9c to e070006 Compare November 27, 2023 15:43
…4908

Since we're not fully supporting multiple range requets yet, we were
initially returning 200 along with full data for them requests. However,
it was pointed out that despite the 200 status code, clients may not
handle this correctly. This is likely the case, so this commit switches
the 200 to 416 (without data) for clarity.

This commit also switches some log messages for invalid ranges from
errors to warnings. We're trying to reserve error messages for potential
issues (bugs or ops problems). Invalid user input doesn't qualify.
@djwhitt djwhitt force-pushed the PE-4908-range-request-integration branch from e070006 to 753c5b9 Compare November 27, 2023 15:47
@djwhitt djwhitt merged commit d81bc52 into develop Nov 27, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants