MCPcopy Index your code
hub / github.com/nytimes/gziphandler

github.com/nytimes/gziphandler @v1.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1.1 ↗ · + Follow
74 symbols 202 edges 4 files 26 documented · 35% 61 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Gzip Handler

This is a tiny Go package which wraps HTTP handlers to transparently gzip the response body, for clients which support it. Although it's usually simpler to leave that to a reverse proxy (like nginx or Varnish), this package is useful when that's undesirable.

Install

go get -u github.com/NYTimes/gziphandler

Usage

Call GzipHandler with any handler (an object which implements the http.Handler interface), and it'll return a new handler which gzips the response. For example:

package main

import (
    "io"
    "net/http"
    "github.com/NYTimes/gziphandler"
)

func main() {
    withoutGz := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        w.Header().Set("Content-Type", "text/plain")
        io.WriteString(w, "Hello, World")
    })

    withGz := gziphandler.GzipHandler(withoutGz)

    http.Handle("/", withGz)
    http.ListenAndServe("0.0.0.0:8000", nil)
}

Documentation

The docs can be found at godoc.org, as usual.

License

Apache 2.0.

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

GzipHandler
called by 12
gzip.go
setAcceptEncodingForPushOptions
called by 5
gzip_go18.go
Close
called by 5
gzip.go
NewGzipLevelHandler
called by 5
gzip.go
poolIndex
called by 4
gzip.go
addLevelPool
called by 3
gzip.go
NewGzipLevelAndMinSize
called by 3
gzip.go
Write
called by 2
gzip.go

Shape

Function 49
Method 17
Struct 6
FuncType 1
TypeAlias 1

Languages

Go100%

Modules by API surface

gzip_test.go38 symbols
gzip.go32 symbols
gzip_go18_test.go2 symbols
gzip_go18.go2 symbols

For agents

$ claude mcp add gziphandler \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page