| 7 | |
| 8 | The [https://www.rfc-editor.org/rfc/rfc2616#section-3.5 RFC] has this: |
| 9 | |
| 10 | > The default (identity) encoding; the use of no transformation whatsoever. This content-coding is used only in the Accept-Encoding header, and SHOULD NOT be used in the Content-Encoding header. |
| 11 | |
| 12 | So you might want to strip that header in a subsequent middleware (but compare the MUST in [https://www.rfc-editor.org/rfc/rfc2616#section-14.11 section 14.11]) |
| 13 | |
| 14 | I think we could consider adding a check here: |
| 15 | |
| 16 | # Avoid gzipping if we've already got a content-encoding. |
| 17 | if response.has_header("Content-Encoding"): |
| 18 | # POSSIBLE ADDITION: remove header if response["Content-Encoding"] == "identity" here. |
| 19 | return response |
| 20 | |
| 21 | With a line in the docs to make this explicit. |
| 22 | |
| 23 | |