{"id":15602692,"url":"https://github.com/luanpotter/http-facade","last_synced_at":"2025-06-10T08:32:12.340Z","repository":{"id":54455242,"uuid":"87656494","full_name":"luanpotter/http-facade","owner":"luanpotter","description":"My take on a simple HTTP Façade for easy request making.","archived":false,"fork":false,"pushed_at":"2021-02-16T20:34:09.000Z","size":384,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-23T19:25:41.002Z","etag":null,"topics":["http-client","java","simple"],"latest_commit_sha":null,"homepage":"","language":"Java","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/luanpotter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-08T18:48:59.000Z","updated_at":"2021-02-16T20:33:30.000Z","dependencies_parsed_at":"2022-08-13T16:10:44.610Z","dependency_job_id":null,"html_url":"https://github.com/luanpotter/http-facade","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luanpotter%2Fhttp-facade","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luanpotter%2Fhttp-facade/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luanpotter%2Fhttp-facade/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luanpotter%2Fhttp-facade/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luanpotter","download_url":"https://codeload.github.com/luanpotter/http-facade/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luanpotter%2Fhttp-facade/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259037764,"owners_count":22796483,"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","java","simple"],"created_at":"2024-10-03T02:50:36.590Z","updated_at":"2025-06-10T08:32:12.301Z","avatar_url":"https://github.com/luanpotter.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# http-facade\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/xyz.luan/http-facade/badge.svg)](https://maven-badges.herokuapp.com/maven-central/xyz.luan/http-facade)\n[![GitHub release](https://img.shields.io/github/release/luanpotter/http-facade.svg)](https://github.com/luanpotter/http-facade/releases)\n[![License](https://img.shields.io/github/license/luanpotter/http-facade.svg)](https://opensource.org/licenses/MIT)\n\nMy take on a simple HTTP Façade for easy request making.\n\nZero-dependency, unobtrusive, Java 7/Google App Engine-ready API for some pretty HTTP handling.\n\n## Maven\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003exyz.luan\u003c/groupId\u003e\n    \u003cartifactId\u003ehttp-facade\u003c/artifactId\u003e\n    \u003cversion\u003e2.5.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Examples\n\nSimple get:\n\n```java\n    Response r = new HttpFacade(\"www.google.com\").get();\n    r.status() // 200\n    r.content() // \u003chtml\u003e...\n```\n\nMore complex request:\n\n```java\n    new HttpFacade(\"luan.xyz/api/people\")\n        .header(\"key\", \"value\")\n        .body(\"{ id: 42, name: \\\"Luan\\\" }\")\n    .post();\n```\n\nParse URL's, set form and query params, handle cookies, authentication (built-in non-platform-dependent Base64 enc/dec), and more.\n\nFor problems with SSL requests and Java outdated CA certificate repositories, see [here](doc/SSL.md).\n\n## Mocking Requests\n\nIf you want to mock a request in order to always retrieve a specific response, instead of actually making the request, you can use MockedHttpFacade and MockedResponse.\n\nSimply inject/instantiate a mocked service to do the request; see the following example:\n\n```java\n\n    class MyService {\n\n        public void sendRequest(String url) {\n            getFacade(url).get();\n        }\n\n        public HttpFacade getFacade(String url) {\n            return new HttpFacade(url);\n        }\n    }\n\n    class MockMyService extends MyService {\n        @Override\n        public HttpFacade getFacade(String url) {\n            MockedResponse.build().withStatus(200).withContent(\"{ name : mock }\");\n            return new MockedHttpFacade(url).mockResponse(mock);\n        }\n    }\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluanpotter%2Fhttp-facade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluanpotter%2Fhttp-facade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluanpotter%2Fhttp-facade/lists"}