{"id":13413294,"url":"https://github.com/henvic/httpretty","last_synced_at":"2025-12-24T17:16:13.695Z","repository":{"id":40522510,"uuid":"236057614","full_name":"henvic/httpretty","owner":"henvic","description":"Package httpretty prints the HTTP requests you make with Go pretty on your terminal.","archived":false,"fork":false,"pushed_at":"2025-10-13T12:50:48.000Z","size":163,"stargazers_count":411,"open_issues_count":5,"forks_count":16,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-10-19T18:41:33.503Z","etag":null,"topics":["cli","go","golang","http"],"latest_commit_sha":null,"homepage":"https://asciinema.org/a/297429","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/henvic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","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},"funding":{"github":"henvic"}},"created_at":"2020-01-24T18:17:16.000Z","updated_at":"2025-10-09T17:15:17.000Z","dependencies_parsed_at":"2023-02-17T21:20:40.710Z","dependency_job_id":"a127c70c-81e2-4599-b05d-98217eee0b4e","html_url":"https://github.com/henvic/httpretty","commit_stats":{"total_commits":63,"total_committers":2,"mean_commits":31.5,"dds":"0.015873015873015928","last_synced_commit":"f741004e44b444fe2c2c141fd723221ab08a7f8a"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/henvic/httpretty","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henvic%2Fhttpretty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henvic%2Fhttpretty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henvic%2Fhttpretty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henvic%2Fhttpretty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/henvic","download_url":"https://codeload.github.com/henvic/httpretty/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henvic%2Fhttpretty/sbom","scorecard":{"id":461702,"data":{"date":"2025-08-11","repo":{"name":"github.com/henvic/httpretty","commit":"3b8d12782835e6fdfecbaab7342c26134f0af285"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.9,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":4,"reason":"Found 6/13 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql.yml:18","Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql.yml:19","Warn: no topLevel permission defined: .github/workflows/codeql.yml:1","Warn: no topLevel permission defined: .github/workflows/go.yml:1","Warn: no topLevel permission defined: .github/workflows/lint.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/henvic/httpretty/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/henvic/httpretty/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/henvic/httpretty/codeql.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/henvic/httpretty/go.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/henvic/httpretty/go.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/go.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/henvic/httpretty/go.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/henvic/httpretty/lint.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/henvic/httpretty/lint.yml/main?enable=pin","Info:   0 out of   7 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"CII-Best-Practices","score":5,"reason":"badge detected: Passing","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 4 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T11:17:44.086Z","repository_id":40522510,"created_at":"2025-08-19T11:17:44.086Z","updated_at":"2025-08-19T11:17:44.086Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28005414,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cli","go","golang","http"],"created_at":"2024-07-30T20:01:37.036Z","updated_at":"2025-12-24T17:16:13.679Z","avatar_url":"https://github.com/henvic.png","language":"Go","readme":"# httpretty\n[![Go Reference](https://pkg.go.dev/badge/github.com/henvic/httpretty.svg)](https://pkg.go.dev/github.com/henvic/httpretty) [![Build Status](https://github.com/henvic/httpretty/workflows/Tests/badge.svg)](https://github.com/henvic/httpretty/actions?query=workflow%3ATests) [![Coverage Status](https://coveralls.io/repos/henvic/httpretty/badge.svg)](https://coveralls.io/r/henvic/httpretty) [![Go Report Card](https://goreportcard.com/badge/github.com/henvic/httpretty)](https://goreportcard.com/report/github.com/henvic/httpretty) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/3669/badge)](https://bestpractices.coreinfrastructure.org/projects/3669)\n\nPackage httpretty prints the HTTP requests of your Go programs pretty on your terminal screen. It is mostly inspired in [curl](https://curl.haxx.se)'s `--verbose` mode, and also on the [httputil.DumpRequest](https://golang.org/pkg/net/http/httputil/) and similar functions.\n\n[![asciicast](https://asciinema.org/a/297429.svg)](https://asciinema.org/a/297429)\n\n## Setting up a logger\nYou can define a logger with something like\n\n```go\nlogger := \u0026httpretty.Logger{\n\tTime:           true,\n\tTLS:            true,\n\tRequestHeader:  true,\n\tRequestBody:    true,\n\tResponseHeader: true,\n\tResponseBody:   true,\n\tColors:         true, // erase line if you don't like colors\n\tFormatters:     []httpretty.Formatter{\u0026httpretty.JSONFormatter{}},\n}\n```\n\nThis code will set up a logger with sane settings. By default the logger prints nothing but the request line (and the remote address, when using it on the server-side).\n\n### Using on the client-side\nYou can set the transport for the [*net/http.Client](https://golang.org/pkg/net/http/#Client) you are using like this:\n\n```go\nclient := \u0026http.Client{\n\tTransport: logger.RoundTripper(http.DefaultTransport),\n}\n\n// from now on, you can use client.Do, client.Get, etc. to create requests.\n```\n\nIf you don't care about setting a new client, you can safely replace your existing http.DefaultClient with this:\n\n```go\nhttp.DefaultClient.Transport = logger.RoundTripper(http.DefaultClient.Transport)\n```\n\nThen httpretty is going to print information about regular requests to your terminal when code such as this is called:\n```go\nif _, err := http.Get(\"https://www.google.com/\"); err != nil {\n        fmt.Fprintf(os.Stderr, \"%+v\\n\", err)\n        os.Exit(1)\n}\n```\n\nHowever, have in mind you usually want to use a custom *http.Client to control things such as timeout.\n\n## Logging on the server-side\nYou can use the logger quickly to log requests on your server. For example:\n\n```go\nlogger.Middleware(mux)\n```\n\nThe handler should by a http.Handler. Usually, you want this to be your `http.ServeMux` HTTP entrypoint.\n\nFor working examples, please see the example directory.\n\n## Filtering\nYou have two ways to filter a request so it isn't printed by the logger.\n\n### httpretty.WithHide\nYou can filter any request by setting a request context before the request reaches `httpretty.RoundTripper`:\n\n```go\nreq = req.WithContext(httpretty.WithHide(ctx))\n```\n\n### Filter function\nA second option is to implement\n\n```go\ntype Filter func(req *http.Request) (skip bool, err error)\n```\n\nand set it as the filter for your logger. For example:\n\n```go\nlogger.SetFilter(func filteredURIs(req *http.Request) (bool, error) {\n\tif req.Method != http.MethodGet {\n\t\treturn true, nil\n\t}\n\n\tif path := req.URL.Path; path == \"/debug\" || strings.HasPrefix(path, \"/debug/\") {\n\t\treturn true, nil\n\t}\n\n\treturn false\n})\n```\n\n## Formatters\nYou can define a formatter for any media type by implementing the Formatter interface.\n\nWe provide a JSONFormatter for convenience (it is not enabled by default).\n","funding_links":["https://github.com/sponsors/henvic"],"categories":["开源类库","Logging","Open source library","日志记录","Go","Relational Databases","Logging 日志库"],"sub_categories":["网络","Search and Analytic Databases","The Internet","检索及分析资料库","Advanced Console UIs","SQL 查询语句构建库"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenvic%2Fhttpretty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhenvic%2Fhttpretty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenvic%2Fhttpretty/lists"}