{"id":20906029,"url":"https://github.com/telanflow/quick","last_synced_at":"2025-05-13T05:31:23.257Z","repository":{"id":57513630,"uuid":"238947893","full_name":"telanflow/quick","owner":"telanflow","description":"HTTP Request library for Go (简洁高效的HTTP请求库)","archived":false,"fork":false,"pushed_at":"2023-10-11T22:08:42.000Z","size":53,"stargazers_count":7,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T18:50:14.850Z","etag":null,"topics":["basic-authentication","cookies","easy","go","http","http-request","middleware","quick","request","requests","session","spider"],"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/telanflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2020-02-07T14:44:27.000Z","updated_at":"2024-05-29T06:12:47.000Z","dependencies_parsed_at":"2024-06-20T06:00:21.362Z","dependency_job_id":null,"html_url":"https://github.com/telanflow/quick","commit_stats":null,"previous_names":["telanflow/requests"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telanflow%2Fquick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telanflow%2Fquick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telanflow%2Fquick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telanflow%2Fquick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/telanflow","download_url":"https://codeload.github.com/telanflow/quick/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253882998,"owners_count":21978586,"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","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":["basic-authentication","cookies","easy","go","http","http-request","middleware","quick","request","requests","session","spider"],"created_at":"2024-11-18T13:28:41.500Z","updated_at":"2025-05-13T05:31:22.851Z","avatar_url":"https://github.com/telanflow.png","language":"Go","readme":"\u003ch1 align=\"center\"\u003e\n  \u003cbr\u003eQuick\u003cbr\u003e\n\u003c/h1\u003e\n\n## 📖 Introduction\n[![GoDoc](https://godoc.org/github.com/telanflow/quick?status.svg)](https://godoc.org/github.com/telanflow/quick)\n![stars](https://img.shields.io/github/stars/telanflow/quick)\n![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/telanflow/quick)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/telanflow/quick)\n[![license](https://img.shields.io/github/license/telanflow/quick)](https://github.com/telanflow/quick/LICENSE)\n\nSimple and efficient HTTP request library\n\nGo开发的简单高效Http请求中间件\n\n## 🚀 Feature\n\n- 支持GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS 请求\n- 支持请求的链式调用\n- Request Body支持 string, []byte, struct, map, slice， io.Reader等类型\n- 兼容Go原生Http.Request请求\n- Response 对象支持请求Trace追踪，内置JSON、XML格式解析\n- 支持Request URL 路径参数、代理设置、Context、BasicAuth\n- 支持设置自定义根证书、客户端证书\n- 支持CookieJar持久化\n- Client支持细粒度超时控制，重定向控制，高并发控制\n- 支持自定义Logger接口\n\n## 🛠 Examples\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/telanflow/quick\"\n    \"net/http\"\n)\n\nfunc main() {\n    // quick.Post(\"example.com\")\n    // quick.PostFormData(\"example.com\")\n    // quick.Put(\"example.com\")\n    // quick.Head(\"example.com\")\n    // quick.Delete(\"example.com\")\n    // quick.Patch(\"example.com\")\n    // quick.Options(\"example.com\")\n    // quick.Trace(\"example.com\")\n\n    // https ssl skip verify 取消https验证\n    quick.InsecureSkipVerify(true)\n\n    // set header\n    quick.SetHeader(http.Header{\n        \"Context-Type\": []string{\"text/html\"},\n    })\n    // set UserAgent to request\n    quick.SetHeaderSingle(\"User-Agent\", \"A go request libraries for quick\")\n    quick.SetUserAgent(\"A go request libraries for quick\")\n    \n    // You should init it by using NewCookiesWithString like this:\n    // \tcookies := quick.NewCookiesWithString(\n    //\t\t\"key1=value1; key2=value2; key3=value3\"\n    // \t)\n    // Note: param is cookie string\n    cookies := quick.NewCookiesWithString(\"sessionid=11111\")\n    \n    // request\n    resp, err := quick.Get(\n        \"http://example.com?bb=1\", \n        quick.OptionQueryString(\"name=quick\u0026aa=11\"),   // set Get params   eg. \"example.com?bb=1\u0026name=quick\u0026aa=11\"\n        quick.OptionHeaderSingle(\"User-Agent\", \"\"),    // set http header\n        quick.OptionHeader(http.Header{}),             // set http header  eg. http.Header || map[string]string || []string\n        quick.OptionRedirectNum(10),                   // set redirect num\n        quick.OptionCookies(cookies),                  // set cookies to request\n        // quick.OptionProxy(\"http://127.0.0.1:8080\"), // set proxy address\n        // quick.OptionBody(\"\"),                       // POST body\n        // quick.OptionBasicAuth(\"username\", \"password\"), // HTTP Basic Authentication\n        // ... quick.Option\n    )\n    if err != nil {\n        panic(err)\n    }\n\n    fmt.Println(resp)\n}\n```\n\n### ♻️ Session\n\nRequest based session\n\n所有Request都基于session（http.Client）\n\n```go\nfunc main() {\n    // cookieJar\n    cookieJar, err := quick.NewCookieJar()\n    if err != nil {\n        panic(err)\n    }\n    \n    // quick use default global session\n    // create session\n    session := quick.NewSession()\n    // https ssl skip verify 取消https验证\n    session.InsecureSkipVerify(true)\n    // set cookieJar\n    session.SetCookieJar(cookieJar) \n    resp, err := session.Get(\"http://example.com\")\n    if err != nil {\n        panic(err)\n    }\n    //resp.Status       e.g. \"200 OK\"\n    //resp.StatusCode   e.g. 200\n    //... \n    fmt.Println(resp)\n}\n```\n\n\nOther example:\n```go\nfunc main() {\n    // new Request\n    req := quick.NewRequest().SetUrl(\"http://example.com\").SetMethod(http.MethodGet)\n\n    // send Request\n    session := quick.NewSession()\n\tsession.EnableTrace() // trace\n    resp, err := session.Suck(\n        req, \n        quick.OptionHeaderSingle(\"User-Agent\", \"\"), // set http header\n        // ... quick.Option\n    )\n    if err != nil {\n        panic(err)\n    }\n\n    // resp.Status       e.g. \"200 OK\"\n    // resp.StatusCode   e.g. 200\n    // ...\n    // \n    // TraceInfo:\n    //      DNSLookup: 4ms\n    //      ConnTime: 1230ms\n    //      TCPConnTime: 405ms\n    //      TLSHandshake: 819ms\n    //      ServerTime: 299ms\n    fmt.Println(resp)\n    fmt.Println(resp.TraceInfo())\n}\n```\n\n## 🧬 Middleware（中间件）\n```go\nfunc main() {\n    // new Request\n    req := quick.NewRequest().SetUrl(\"http://example.com\").SetMethod(http.MethodGet)\n\n    // create session\n    session := quick.NewSession()\n\n    // use middleware\n    session.Use(\n        // middleware 1\n        func(r *http.Request) {\n            log.Printf(\n                \"Middleware: %v RedirectNum: %v Proxy: %v \\n\",\n                r.URL,\n                r.Context().Value(quick.ContextRedirectNumKey),\n                r.Context().Value(quick.ContextProxyKey),\n            )\n        },\n        // middleware 2\n        func(r *http.Request) {\n            log.Printf(\n                \"Middleware2: %v RedirectNum: %v Proxy: %v \\n\",\n                r.URL,\n                r.Context().Value(quick.ContextRedirectNumKey),\n                r.Context().Value(quick.ContextProxyKey),\n            )\n        },\n    )\n\n    // send Request\n    resp, err := session.Suck(\n        req, \n        quick.OptionHeaderSingle(\"User-Agent\", \"\"), // set http header\n        // ... quick.Option\n    )\n    if err != nil {\n        panic(err)\n    }\n\n    //resp.Status       e.g. \"200 OK\"\n    //resp.StatusCode   e.g. 200\n    //... \n    fmt.Println(resp)\n}\n```\n\n## 📄 License\nSource code in `QUICK` is available under the [MIT License](/LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelanflow%2Fquick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelanflow%2Fquick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelanflow%2Fquick/lists"}