kwilteam / kwil-db

Kwil DB, the database for web3
https://www.kwil.com/
Other
36 stars 12 forks source link

services/jsonrpc: compress middleware #1092

Closed jchappelow closed 2 days ago

jchappelow commented 2 days ago

Without compression:

$  curl -s -o /dev/null -w "Bytes Transferred: %{size_download} bytes\n" -H "content-type: application/json" -d '{"jsonrpc":"2.0","method":"user.schema","params":{"dbid":"xc4503ccf15daada96e36cbbacf641f48ebc6226e28906c8757866b91"},"id":1}' http://127.0.0.1:8484/rpc/v1 Bytes Transferred: 4812 bytes

With compression:

$  curl -s --compressed -o /dev/null -w "Bytes Transferred: %{size_download} bytes\n" -H "content-type: application/json" -d '{"jsonrpc":"2.0","method":"user.schema","params":{"dbid":"xc4503ccf15daada96e36cbbacf641f48ebc6226e28906c8757866b91"},"id":1}' http://127.0.0.1:8484/rpc/v1 Bytes Transferred: 1039 bytes

jchappelow commented 2 days ago

Ok, I verified that the kwil-cli http.Client did in fact decompress the response in the http.Transport. I think this is working.