cowprotocol / solver-template-py

A hollow framework for a CoW Protocol solver
MIT License
39 stars 25 forks source link

feat: gzip #18

Closed poolpitako closed 2 years ago

bh2smith commented 2 years ago

Hey @poolpitako - thanks for the contribution. Would you mind explaining a bit the motivation for this and what it is actually for?

poolpitako commented 2 years ago

@bh2smith enabling gzip support for all endpoints. Default is 500 bytes. Example in the solver I am working on:

curl without gzip headers:

curl -vX POST "http://127.0.0.1:8000/solve" -H  "accept: application/json" -H  "Content-Type: application/json" --data "@/Users/user/dev/yswap-solver/data/one_inch_example.json"

response:

< content-length: 25203
< content-type: application/json

curl with gzip headers:

curl -vX POST "http://127.0.0.1:8000/solve" -H "Accept-Encoding: gzip" -H  "accept: application/json" -H  "Content-Type: application/json" --data "@/Users/user/dev/yswap-solver/data/one_inch_example.json"

response:

< content-length: 1597
< content-type: application/json
< content-encoding: gzip
bh2smith commented 2 years ago

Looks good then. Does you second example need to be a zip file rather than json?