apache / apache/couchdb

Deflate compression for requests

Open
#4,500 0 comments 0 reactions 0 assignees View on GitHub
enhancement needs-triage
Dominant language
Erlang
Stars
7k
Forks
1.1k
Avg merge
1d 16h
Merged PRs (30d)
9

Description

CouchDB REST API does not seem to support requests with [Deflate](https://en.wikipedia.org/wiki/Deflate) compression. On the contrary, this is the only method that [HTTPie](https://httpie.io/) offers, which can make it difficult to use against the API when compression comes into question. For example, assuming that database `test` has been created on `localhost` and `docs.json` contains the uncompressed body of the request:

```console
$ http --compress post http://adm:pass@localhost:15984/test/_bulk_docs @docs.json
HTTP/1.1 415 Unsupported Media Type
Cache-Control: must-revalidate
Content-Length: 85
Content-Type: application/json
Date: Tue, 28 Mar 2023 12:42:42 GMT
Server: CouchDB/3.3.1-467e14e (Erlang OTP/24)
X-Couch-Request-ID: 55b8b8f5ca
X-CouchDB-Body-Time: 57

{
"error": "bad_content_type",
"reason": "deflate is not a supported content encoding."
}
```

Add support for this content type to make `http` work in such scenarios.

Contributor guide

Open the contributing guide

Research direction

Use the HTTPie reproduction against POST /test/_bulk_docs as the entry point; first rerun it with docs.json and inspect how the request's content encoding is handled. Done means the compressed request is accepted instead of returning 415 Unsupported Media Type.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
backend-api-design, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.