{"id":36674171,"url":"https://github.com/tigerwill90/foxdump","last_synced_at":"2026-01-12T10:47:07.063Z","repository":{"id":176272962,"uuid":"649447563","full_name":"tigerwill90/foxdump","owner":"tigerwill90","description":"Efficient body dumping middleware for Fox","archived":false,"fork":false,"pushed_at":"2025-11-09T10:27:13.000Z","size":4437,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-11-09T12:15:41.050Z","etag":null,"topics":["dumper","fox","go","golang","middleware"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tigerwill90.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-06-04T21:37:07.000Z","updated_at":"2025-11-09T10:23:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"f474719c-8bac-4e98-8730-651c1c62a2bd","html_url":"https://github.com/tigerwill90/foxdump","commit_stats":null,"previous_names":["tigerwill90/foxdump"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/tigerwill90/foxdump","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tigerwill90%2Ffoxdump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tigerwill90%2Ffoxdump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tigerwill90%2Ffoxdump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tigerwill90%2Ffoxdump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tigerwill90","download_url":"https://codeload.github.com/tigerwill90/foxdump/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tigerwill90%2Ffoxdump/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T10:40:25.642Z","status":"ssl_error","status_checked_at":"2026-01-12T10:39:27.820Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dumper","fox","go","golang","middleware"],"created_at":"2026-01-12T10:47:06.967Z","updated_at":"2026-01-12T10:47:07.049Z","avatar_url":"https://github.com/tigerwill90.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Reference](https://pkg.go.dev/badge/github.com/tigerwill90/foxdump.svg)](https://pkg.go.dev/github.com/tigerwill90/foxdump)\n[![tests](https://github.com/tigerwill90/foxdump/actions/workflows/tests.yaml/badge.svg)](https://github.com/tigerwill90/foxdump/actions?query=workflow%3Atests)\n[![Go Report Card](https://goreportcard.com/badge/github.com/tigerwill90/foxdump)](https://goreportcard.com/report/github.com/tigerwill90/foxdump)\n[![codecov](https://codecov.io/gh/tigerwill90/foxdump/branch/master/graph/badge.svg?token=D6qSTlzEcE)](https://codecov.io/gh/tigerwill90/foxdump)\n![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/tigerwill90/foxdump)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/tigerwill90/foxdump)\n\n# Foxdump\nFoxdump is a middleware for [Fox](https://github.com/tigerwill90/fox) that provides an efficient way to dump \nHTTP request and response bodies. This feature can be extremely useful for debugging, logging, testing, and \nmonitoring HTTP traffic.\n\n## Disclaimer\nFoxdump's API is linked to Fox router, and it will only reach v1 when the router is stabilized.\nDuring the pre-v1 phase, breaking changes may occur and will be documented in the release notes.\n\n## Getting started\n### Installation\n````shell\ngo get -u github.com/tigerwill90/foxdump\n````\n\n### Features\n- Efficient body dumping with minimal performance impact (zero allocation).\n- Can be configured to dump either request, response, or both bodies.\n- Easily integrate with Fox ecosystem.\n\n### Usage\n\nHere's a simple example of how to use the Foxdump middleware:\n````go\npackage main\n\nimport (\n\t\"errors\"\n\t\"io\"\n\t\"log\"\n\t\"net/http\"\n\n\t\"github.com/tigerwill90/fox\"\n\t\"github.com/tigerwill90/foxdump\"\n)\n\nfunc DumpRequest(c *fox.Context, buf []byte) {\n\tlog.Println(\"request:\", string(buf))\n}\n\nfunc DumpResponse(c *fox.Context, buf []byte) {\n\tlog.Println(\"response:\", string(buf))\n}\n\nfunc main() {\n\tf := fox.MustRouter(\n\t\tfox.WithMiddleware(foxdump.Middleware(DumpRequest, DumpResponse)),\n\t)\n\n\tf.MustAdd(fox.MethodPost, \"/hello/fox\", func(c *fox.Context) {\n\t\t_, _ = io.Copy(c.Writer(), c.Request().Body)\n\t})\n\n\tif err := http.ListenAndServe(\":8080\", f); err != nil \u0026\u0026 !errors.Is(err, http.ErrServerClosed) {\n\t\tlog.Fatalln(err)\n\t}\n}\n````\n\nNote that the `buf` slice is transient, and its data is only guaranteed to be valid during the execution of the \n`foxdump.BodyHandler` function. If the data needs to be persisted or used outside the scope of this function, it should be copied \nto a new byte slice (e.g. using `copy`). Furthermore, `buf` should be treated as read-only to prevent any unintended \nside effects.\n\n## Benchmark\n````\ngoos: linux\ngoarch: amd64\npkg: github.com/tigerwill90/foxdump\ncpu: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz\nBenchmarkFoxDumpMiddleware-16            7333161             157.9 ns/op               0 B/op          0 allocs/op\nBenchmarkEchoDumpMiddleware-16           1215985              1618 ns/op            2665 B/op         10 allocs/op\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftigerwill90%2Ffoxdump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftigerwill90%2Ffoxdump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftigerwill90%2Ffoxdump/lists"}