{"id":16413081,"url":"https://github.com/groguelon/any_http","last_synced_at":"2025-11-16T21:04:23.987Z","repository":{"id":182899115,"uuid":"669336139","full_name":"GRoguelon/any_http","owner":"GRoguelon","description":"Elixir library to wrap the main HTTP libraries.","archived":false,"fork":false,"pushed_at":"2024-04-02T02:11:05.000Z","size":98,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-06T10:03:44.322Z","etag":null,"topics":["elixir","hex","http"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/any_http","language":"Elixir","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/GRoguelon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-07-22T00:57:45.000Z","updated_at":"2023-12-09T00:25:08.000Z","dependencies_parsed_at":"2024-03-13T05:47:28.870Z","dependency_job_id":null,"html_url":"https://github.com/GRoguelon/any_http","commit_stats":null,"previous_names":["groguelon/any_http"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GRoguelon%2Fany_http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GRoguelon%2Fany_http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GRoguelon%2Fany_http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GRoguelon%2Fany_http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GRoguelon","download_url":"https://codeload.github.com/GRoguelon/any_http/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240436288,"owners_count":19800900,"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":["elixir","hex","http"],"created_at":"2024-10-11T06:50:34.128Z","updated_at":"2025-11-16T21:04:23.872Z","avatar_url":"https://github.com/GRoguelon.png","language":"Elixir","readme":"# Any HTTP\n\nElixir library which wraps the main HTTP libraries. It allows the final project to decide which\nHTTP library they want to use and provide an unified interface.\n\n[Documentation](https://hexdocs.pm/any_http)\n\n## Installation\n\n```elixir\ndef deps do\n  [\n    {:any_http, \"~\u003e 0.6\"}\n  ]\nend\n```\n\n## Configuration\n\n### [:httpc](https://www.erlang.org/doc/man/httpc.html)\n\n`:httpc` is already part of your application because it's part of Erlang.\n\nChange your configuration to declare Req as your adapter:\n```elixir\nconfig :any_http, client_adapter: AnyHttp.Adapters.Httpc\n\n# You can provide default options to the adapter.\nconfig :any_http, httpc_default_opts: []\n```\n\n### [Req](https://hexdocs.pm/req)\n\nAdd Req to your `mix.exs` file:\n```elixir\ndef deps do\n  [\n    {:req, \"~\u003e 0.4\"}\n  ]\nend\n```\n\nChange your configuration to declare Req as your adapter:\n```elixir\nconfig :any_http, client_adapter: AnyHttp.Adapters.Req\n\n# You can provide default options to the adapter.\nconfig :any_http, req_default_opts: []\n```\n\n### [:hackney](https://hexdocs.pm/hackney/)\n\nAdd Req to your `mix.exs` file:\n```elixir\ndef deps do\n  [\n    {:hackney, \"~\u003e 1.20\"}\n  ]\nend\n```\n\nChange your configuration to declare Req as your adapter:\n```elixir\nconfig :any_http, client_adapter: AnyHttp.Adapters.Hackney\n\n# You can provide default options to the adapter.\nconfig :any_http, hackney_default_opts: []\n```\n\n## Usage\n\nJust call the `AnyHttp` module to interact with HTTP:\n\n```elixir\nAnyHttp.post(\n  # Provide the URL as a string or an URI\n  \"https://my_server/api\",\n  # Provide the HTTP headers as map or list of tuple, put nil if none\n  %{\"content-type\" =\u003e \"application/json\"},\n  # Provide the body, put nil if none\n  ~s\u003c{\"hello\": \"world\"}\u003e,\n  # Provide the adapter options, can be ommited\n  receive_timeout: :timer.seconds(5)\n)\n```\n\nThe result will look like:\n\n```elixir\n{:ok,\n  %AnyHttp.Response{\n    status: 201,\n    headers: %{\"content-type\" =\u003e [\"application/json\"]},\n    body: \"{\\\"bye\\\":\\\"world\\\"}\"\n  }\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgroguelon%2Fany_http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgroguelon%2Fany_http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgroguelon%2Fany_http/lists"}