{"id":19621638,"url":"https://github.com/pkg6/go-requests","last_synced_at":"2025-09-16T01:31:25.459Z","repository":{"id":176683472,"uuid":"623750236","full_name":"pkg6/go-requests","owner":"pkg6","description":"A simple, yet elegant, HTTP library.","archived":true,"fork":false,"pushed_at":"2025-05-20T07:12:04.000Z","size":180,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-20T08:25:09.828Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pkg6.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-04-05T02:21:28.000Z","updated_at":"2025-05-20T07:12:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"651478f4-e2ae-45ba-babf-0164e2e7415f","html_url":"https://github.com/pkg6/go-requests","commit_stats":null,"previous_names":["pkg6/go-requests"],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/pkg6/go-requests","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fgo-requests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fgo-requests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fgo-requests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fgo-requests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pkg6","download_url":"https://codeload.github.com/pkg6/go-requests/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fgo-requests/sbom","scorecard":{"id":736417,"data":{"date":"2025-08-11","repo":{"name":"github.com/pkg6/go-requests","commit":"88a24db7253ef7a92be2b93ef5d5dbc057ed2955"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"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":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go-test.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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"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/go-test.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/pkg6/go-requests/go-test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go-test.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/pkg6/go-requests/go-test.yml/main?enable=pin","Info:   0 out of   2 GitHub-owned 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":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","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":"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:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"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":4,"reason":"6 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2023-2102 / GHSA-4374-p667-p6c8","Warn: Project is vulnerable to: GHSA-qppj-fm5r-hxr3","Warn: Project is vulnerable to: GO-2024-2687 / GHSA-4v7x-pqxf-cx7m","Warn: Project is vulnerable to: GO-2024-3333","Warn: Project is vulnerable to: GO-2025-3503 / GHSA-qxp5-gwg8-xv66","Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T16:00:00.755Z","repository_id":176683472,"created_at":"2025-08-22T16:00:00.755Z","updated_at":"2025-08-22T16:00:00.755Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275348305,"owners_count":25448628,"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-09-15T02:00:09.272Z","response_time":75,"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":[],"created_at":"2024-11-11T11:23:50.488Z","updated_at":"2025-09-16T01:31:25.161Z","avatar_url":"https://github.com/pkg6.png","language":"Go","readme":"[![Test Status](https://github.com/pkg6/go-requests/actions/workflows/go-test.yml/badge.svg)](https://github.com/pkg6/go-requests/actions)\n[![Go Report Card](https://goreportcard.com/badge/github.com/pkg6/go-requests)](https://goreportcard.com/report/github.com/pkg6/go-requests)\n[![Go.Dev reference](https://img.shields.io/badge/go.dev-reference-blue?logo=go\u0026logoColor=white)](https://pkg.go.dev/github.com/pkg6/go-requests?tab=doc)\n[![Sourcegraph](https://sourcegraph.com/github.com/pkg6/go-requests/-/badge.svg)](https://sourcegraph.com/github.com/pkg6/go-requests?badge)\n[![Release](https://img.shields.io/github/release/pkg6/go-requests.svg?style=flat-square)](https://github.com/pkg6/go-requests/releases)\n\n## 基本介绍\n\n`GoRequests`框架提供了强大便捷易用的HTTP客户端，基于`http.Client`进行扩展开发，对象创建可以通过`requests.New()`包方法，也可以通过`new(requests.Client).Clone()`方法调用，同时你还可以使用`requests.NewHttpClient(requests.DefaultHttpClient(nil))`创建对象。推荐使用`requests.New()`来便捷地创建HTTP客户端对象。\n\n## 安装\n\n~~~\n$ go get github.com/pkg6/go-requests\n~~~\n\n\n## 基础使用\n\n~~~\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"github.com/pkg6/go-requests\"\n\t\"net/url\"\n)\n\nfunc main() {\n\tdata := url.Values{}\n\tdata.Set(\"k\", \"v\")\n\tget, _ := requests.New().Get(context.Background(), \"http://www.httpbin.org/get\", data)\n\tdefer get.Close()\n\tfmt.Println(get.ReadAllString())\n\tpost, _ := requests.New().AsJson().Post(context.Background(), \"http://www.httpbin.org/post\", data)\n\tdefer post.Close()\n\tfmt.Println(post.ReadAllString())\n}\n\n~~~\n\n## 文件上传\n\n~~~\nu := url.Values{}\nu.Set(\"服务端接受的name名称\", \"@file:loaclfile.txt\")\nrequest := requests.New()\nrequest.PostForm(context.Background(), \"http://127.0.0.1/upload\", u)\n~~~\n\n## stream请求与返回处理\n\n[ChatGPT【以微软为例】](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/how-to/function-calling)\n\n~~~\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/pkg6/go-requests\"\n)\n\nfunc main() {\n\tpayload := `{\n  \"messages\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"You are an AI assistant that helps people find information.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"你是谁\"\n    }\n  ],\n  \"model\":\"gpt-35-turbo\",\n  \"temperature\": 0.7,\n  \"top_p\": 0.95,\n  \"frequency_penalty\": 0,\n  \"presence_penalty\": 0,\n  \"max_tokens\": 800,\n  \"stop\": null,\n  \"stream\":true \n}`\n\n\tjson, _ := requests.PostJson(\"end-point url\", payload, func(client *requests.Client) {\n\t\tclient.WithHeader(\"api-key\", \"api-key\")\n\t})\n\tdefer json.Close()\n\tjson.ReadStream(func(line []byte, number int64) {\n\t\tfmt.Println(string(line))\n\t})\n}\n\n~~~\n\n## 方法列表\n\n[https://pkg.go.dev/github.com/pkg6/go-requests]( https://pkg.go.dev/github.com/pkg6/go-requests)\n\n## 返回对象\n\n~~~\n(r *Response) Close() error\n(r *Response) TraceInfo() TraceInfo\n(r *Response) GetCookie() Cookie\n(r *Response) ReadAll() []byte\n(r *Response) ReadStream(lineNumberFun func(line []byte, number int64)) int64\n(r *Response) ReadAllString() string\n(r *Response) ContentType() string\n(r *Response) Unmarshal(d any) error\n(r *Response) IsSuccess() bool\n(r *Response) IsError() bool\n~~~\n\n## 加入我们\n\n如果你认可我们的开源项目，有兴趣为 [go-requests](https://github.com/pkg6/go-requests) 的发展做贡献，竭诚欢迎加入我们一起开发完善。无论是[报告错误](https://github.com/pkg6/go-requests/issues)或是 [Pull Request](https://github.com/pkg6/go-requests/pulls) 开发，那怕是修改一个错别字也是对我们莫大的帮助。\n\n## License\n\ngo-requests is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0) License - see the [LICENSE](https://github.com/pkg6/go-requests/blob/main/LICENSE) file for details\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkg6%2Fgo-requests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpkg6%2Fgo-requests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkg6%2Fgo-requests/lists"}