{"id":21949787,"url":"https://github.com/dogukanayd/requester","last_synced_at":"2025-08-14T12:43:00.063Z","repository":{"id":44997210,"uuid":"445574995","full_name":"dogukanayd/requester","owner":"dogukanayd","description":"mockable Go request package","archived":false,"fork":false,"pushed_at":"2022-01-14T18:31:27.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-02T10:03:14.905Z","etag":null,"topics":["go","golang","http","request","testable"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/dogukanayd/requester","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/dogukanayd.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}},"created_at":"2022-01-07T15:56:58.000Z","updated_at":"2022-01-10T06:23:50.000Z","dependencies_parsed_at":"2022-09-26T22:30:40.995Z","dependency_job_id":null,"html_url":"https://github.com/dogukanayd/requester","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/dogukanayd/requester","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dogukanayd%2Frequester","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dogukanayd%2Frequester/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dogukanayd%2Frequester/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dogukanayd%2Frequester/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dogukanayd","download_url":"https://codeload.github.com/dogukanayd/requester/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dogukanayd%2Frequester/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270422549,"owners_count":24580824,"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-08-14T02:00:10.309Z","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":["go","golang","http","request","testable"],"created_at":"2024-11-29T05:36:22.108Z","updated_at":"2025-08-14T12:43:00.024Z","avatar_url":"https://github.com/dogukanayd.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Requester\n\n[![Coverage Status](https://coveralls.io/repos/github/dogukanayd/requester/badge.svg?branch=main)](https://coveralls.io/github/dogukanayd/requester?branch=main)\n\nRequest is a HTTP request library for Go with interfaces and mocks for unit tests.\n\n\nThe reason for having this package is using the interfaces to mock the HTTP requests easily on the codebase. Before\ncreating this repository I was copying and pasting this package to my projects. So I decided to move this package to the\nseparated package from my projects and use it with all of my projects.\n\n## How to use?\n\nIn your codebase, you should create a package called \"requester\" or with a name anything that you want. After that, you \nhave to create exactly the same interfaces that the package provides. Right after that you can mock the methods and \nuse them inside your unit tests.\n\nExample usage of the package:\n```go\ntype ExampleRequestBody struct {\n\tName    string\n\tSurname string\n}\n\nfunc example() {\n\terb := ExampleRequestBody{\n\t\tName:    \"Dogukan\",\n\t\tSurname: \"Aydogdu\",\n\t}\n\n\terbj, _ := json.Marshal(erb)\n\n\tresponse, err := (\u0026Request{\n\t\tTimeout: 60,\n\t\tHeaders: []map[string]interface{}{\n\t\t\t{\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t},\n\t\t},\n\t\tEndpoint: \"https://www.example.com\",\n\t\tBody:     erbj,\n\t}).Post()\n}\n```\n\nExample for mock the interface your own codebase:\n\n```go\npackage your_request_package\n\nimport (\n\t\"github.com/dogukanayd/requester\"\n\t\"net/http\"\n)\n\ntype Requester interface {\n\tGet() (*http.Response, error)\n\tPost() (*http.Response, error)\n\tPut() (*http.Response, error)\n\tDelete() (*http.Response, error)\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdogukanayd%2Frequester","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdogukanayd%2Frequester","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdogukanayd%2Frequester/lists"}