Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 1.68 KB

http-dump.md

File metadata and controls

32 lines (23 loc) · 1.68 KB

HTTP dumps

Trap dumps any HTTP request that no other module takes: the method, the URI, the headers, the cookies, the query and the body, with uploaded files. Use it to see what a webhook, a browser form or an HTTP client really sends.

Receive requests

Send the request to any port of Trap, e.g. 8000:

curl -X POST 'http://127.0.0.1:8000/webhook?source=billing' -H 'Content-Type: application/json' -d '{"paid":true}'

Trap answers a dumped request with 404.

To try it in a browser, open http://127.0.0.1:8000/_debug: any path ending with _debug shows a test form, which posts to /_debug/bar. That request is dumped and answered with 200. The form is a sandboxed page without an origin: it can't call the UI API.

http-dump

Notes

  • The requests of Sentry, cron pings to /ping/..., Ray, the profilers, OpenTelemetry and CSP reports and HTML pages go to their modules and are not dumped.
  • When the web UI runs on the same port, it answers /, the paths of its files, e.g. /favicon.ico, its /api/... routes, e.g. /api/events, and a browser opening a page of the UI, e.g. /smtp: see Port.
  • The web UI lists the files uploaded with a request and downloads them.
  • A gzip-compressed body may inflate, and a chunked body may decode, up to TRAP_HTTP_MAX_INFLATED_SIZE (default 64M); a bigger one gets 413. See Configuration.
  • A body sent with Transfer-Encoding: chunked is dumped decoded, with Content-Length in place of Transfer-Encoding.