Skip to content

Accept gzip encoded content on webhooks #3937

@josephjclark

Description

@josephjclark

Webhooks currently accept JSON data, which will be sent for processing to the workflow.

But the webhooks do NOT accept gzip-encoded data.

Gzipping is a typical way to compress payloads on the wire.

Note that we're NOT talking about attaching a gzip file and extracting it somewhere. We're just talking about how the request body content is encoded.

But it doesn't work today! We get:

Plug.Parsers.ParseError) malformed request, a Jason.DecodeError exception was raised with message "unexpected byte at position 0: 0x1F"
        (plug 1.18.1) lib/plug/parsers/json.ex:95: Plug.Parsers.JSON.decode/3
        (plug 1.18.1) lib/plug/parsers.ex:341: Plug.Parsers.reduce/8

Reproduction Steps

Use CURL to send a JSON object into your favourite webhook:

curl -v -X POST \
  http://localhost:4000/i/ab1801c2-3af0-40cf-8f0c-b743a0afce9b \
  --json @tmp/payload.json \
  --compressed

The --compressed flag will gzip the body

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    In review

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions