RobotsAndPencils/buford

gzip the payload?

nathany opened this issue · 2 comments

gzip the payload?

I attempted to gzip the request with the following:

buf := new(bytes.Buffer)
w := gzip.NewWriter(buf)
w.Write(payload)
w.Close()

req.Header.Set("Content-Encoding", "gzip")

Apple returned a 200 OK but I didn't see the notification on my phone. Maybe Apple just passes the notification on and the app I'm testing with doesn't itself handle gzip.

Of note, the gzip payload had a larger content-length, at least in the simple case: 67 vs. 43.

On the response side, using the GODEBUG=http2debug=1 flag indicates that Go is already accepting gzip responses, and presumably decoding them for us if Apple is sending them.

http2: Transport encoding header "accept-encoding" = "gzip"

The body data must not be compressed

from Apple's docs