{"id":29108247,"url":"https://github.com/fako1024/httpc","last_synced_at":"2025-06-29T06:08:46.463Z","repository":{"id":39602864,"uuid":"208796894","full_name":"fako1024/httpc","owner":"fako1024","description":"A simple wrapper around the default Go http client optimized for ease-of-use ","archived":false,"fork":false,"pushed_at":"2025-04-24T14:37:47.000Z","size":188,"stargazers_count":3,"open_issues_count":4,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-28T20:58:39.264Z","etag":null,"topics":["http-client","method-chaining","openapi-specification","openapi3"],"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/fako1024.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":"2019-09-16T12:42:06.000Z","updated_at":"2025-04-24T14:32:29.000Z","dependencies_parsed_at":"2023-02-17T07:15:44.751Z","dependency_job_id":"bd2cc035-6c9c-41d6-88c1-0dcbca1862f3","html_url":"https://github.com/fako1024/httpc","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/fako1024/httpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fako1024%2Fhttpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fako1024%2Fhttpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fako1024%2Fhttpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fako1024%2Fhttpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fako1024","download_url":"https://codeload.github.com/fako1024/httpc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fako1024%2Fhttpc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262545037,"owners_count":23326660,"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":["http-client","method-chaining","openapi-specification","openapi3"],"created_at":"2025-06-29T06:08:43.923Z","updated_at":"2025-06-29T06:08:46.441Z","avatar_url":"https://github.com/fako1024.png","language":"Go","readme":"# A simple wrapper around the default Go http client optimized for ease-of-use\n\n[![Github Release](https://img.shields.io/github/release/fako1024/httpc.svg)](https://github.com/fako1024/httpc/releases)\n[![GoDoc](https://godoc.org/github.com/fako1024/httpc?status.svg)](https://godoc.org/github.com/fako1024/httpc/)\n[![Go Report Card](https://goreportcard.com/badge/github.com/fako1024/httpc)](https://goreportcard.com/report/github.com/fako1024/httpc)\n[![Build/Test Status](https://github.com/fako1024/httpc/workflows/Go/badge.svg)](https://github.com/fako1024/httpc/actions?query=workflow%3AGo)\n[![CodeQL](https://github.com/fako1024/httpc/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/fako1024/httpc/actions/workflows/codeql-analysis.yml)\n\nThis package wraps the Go standard http client, providing a simplified interaction model using method chaining and additional capabilities such as optional in-flow validation against an OpenAPI specification.\n\n## Features\n- Simple, method chaining based interface for HTTP client requests\n- Simulation of request delays\n- Validation of request + response against OpenAPI specification\n- Customization of HTTP client via functional parameter\n- Back-Off-Retry concept to automatically retry requests if required\n\n## Installation\n```bash\ngo get -u github.com/fako1024/httpc\n```\n\n## Examples\n#### Perform simple HTTP GET request\n```go\nerr := httpc.New(\"GET\", \"http://example.org\").Run()\nif err != nil {\n\tlog.Fatalf(\"error performing GET request: %s\", err)\n}\n```\n\n#### Perform HTTP GET request and parse the result as JSON into a struct\n```go\nvar res = struct {\n\tStatus int\n\tMessage string\n}{}\nerr := httpc.New(\"GET\", \"http://example.org\").\n\tParseJSON(\u0026res).\n\tRun()\nif err != nil {\n\tlog.Fatalf(\"error performing GET request: %s\", err)\n}\n```\n\n#### Perform HTTPS POST request with a simple body, disabling certificate validation and copying the response to a bytes.Buffer\n```go\nbuf := new(bytes.Buffer)\nerr := httpc.New(\"POST\", \"https://example.org\").\n\tSkipCertificateVerification().\n\tBody([]byte{0x1, 0x2}).\n\tParseFn(httpc.Copy(buf)).\n\tRun()\n\nif err != nil {\n    log.Fatalf(\"error performing POST request: %s\", err)\n}\n\nfmt.Println(buf.String())\n```\n\n#### Perform HTTPS GET request (with query parameters + headers + basic auth), validating request and response against OpenAPIv3 specification\n```go\nopenAPIFileData, err := os.ReadFile(\"/tmp/openapi.json\")\nif err != nil {\n\tlog.Fatalf(\"Error opening OpenAPI specification file: %s\", err)\n}\n\nerr = httpc.New(\"GET\", \"https://example.org\").\n\tSkipCertificateVerification().\n\tQueryParams(httpc.Params{\n\t\t\"param\": \"test\",\n\t}).\n\tHeaders(httpc.Params{\n\t\t\"X-HEADER-TEST\": \"test\",\n\t}).\n\tAuthBasic(\"username\", \"password\").\n\tOpenAPIValidationFileData(openAPIFileData).\n\tRun()\n\nif err != nil {\n\tlog.Fatalf(\"error performing GET request: %s\", err)\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffako1024%2Fhttpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffako1024%2Fhttpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffako1024%2Fhttpc/lists"}