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

REST API: Add compression to REST API (#1390) #1394

Merged

Conversation

Eric-Warehime
Copy link
Contributor

This merges the changes from #1390 into the hotfix branch. I've done this via a separate PR because it was easier than changing the base of the previous PR and resolving a bunch of merge conflicts.

Here's a copy of the description of the other PR for reference:

Summary

In order to more easily support returning responses for blocks containing large numbers of transactions, we're adding gzip compression as an available response content encoding.

In order to have a response gzip'd (limited in this PR only to the /v2/block/ endpoint) clients can provide the header:

Accept-Encoding: gzip

For example, in the go-algorand-sdk, you could use the following code to retrieve a compressed block:

client.LookupBlock(rnd).Do(ctx, &common.Header{Key: "Accept-Encoding", Value: "gzip"})

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding for more details on the Accept-Encoding header.

Test Plan

Added tests for compressed responses from /v2/blocks.

@codecov
Copy link

codecov bot commented Dec 27, 2022

Codecov Report

Merging #1394 (4804caf) into hotfix/2.15.1 (300b69f) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@                Coverage Diff                @@
##           hotfix/2.15.1    #1394      +/-   ##
=================================================
+ Coverage          65.02%   65.03%   +0.01%     
=================================================
  Files                 52       52              
  Lines               8311     8315       +4     
=================================================
+ Hits                5404     5408       +4     
  Misses              2433     2433              
  Partials             474      474              
Impacted Files Coverage Δ
api/server.go 63.75% <100.00%> (+1.90%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Eric-Warehime Eric-Warehime merged commit 8c49730 into algorand:hotfix/2.15.1 Dec 27, 2022
@Eric-Warehime Eric-Warehime deleted the merge-compression-hotfix branch December 27, 2022 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants