{"id":17543613,"url":"https://github.com/xkcoding/simple-http","last_synced_at":"2025-04-14T22:51:21.206Z","repository":{"id":36758620,"uuid":"229922815","full_name":"xkcoding/simple-http","owner":"xkcoding","description":"抽取一个简单 HTTP 的通用接口，底层实现根据具体引入依赖指定。","archived":false,"fork":false,"pushed_at":"2023-02-09T03:42:35.000Z","size":111,"stargazers_count":52,"open_issues_count":5,"forks_count":21,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T10:54:10.032Z","etag":null,"topics":["http","httpclient","hutool-http","java","okhttp3","xkcoding"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xkcoding.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":"2019-12-24T10:37:35.000Z","updated_at":"2024-07-15T08:04:30.000Z","dependencies_parsed_at":"2022-08-08T17:01:01.556Z","dependency_job_id":null,"html_url":"https://github.com/xkcoding/simple-http","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkcoding%2Fsimple-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkcoding%2Fsimple-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkcoding%2Fsimple-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkcoding%2Fsimple-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xkcoding","download_url":"https://codeload.github.com/xkcoding/simple-http/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248975299,"owners_count":21192199,"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","httpclient","hutool-http","java","okhttp3","xkcoding"],"created_at":"2024-10-21T00:25:00.464Z","updated_at":"2025-04-14T22:51:21.177Z","avatar_url":"https://github.com/xkcoding.png","language":"Java","readme":"\u003ch1 align=\"center\"\u003e\u003ca href=\"https://github.com/xkcoding/simple-http\" target=\"_blank\"\u003eSimple-HTTP\u003c/a\u003e\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://travis-ci.com/xkcoding/simple-http\" target=\"_blank\"\u003e\u003cimg alt=\"Travis-CI\" src=\"https://travis-ci.com/xkcoding/simple-http.svg?branch=master\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://search.maven.org/artifact/com.xkcoding.http/simple-http\" target=\"_blank\"\u003e\u003cimg alt=\"MAVEN\" src=\"https://img.shields.io/maven-central/v/com.xkcoding.http/simple-http.svg?color=brightgreen\u0026label=Maven%20Central\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://xkcoding.com\" target=\"_blank\"\u003e\u003cimg alt=\"author\" src=\"https://img.shields.io/badge/author-Yangkai.Shen-blue.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.oracle.com/technetwork/java/javase/downloads/index.html\" target=\"_blank\"\u003e\u003cimg alt=\"JDK\" src=\"https://img.shields.io/badge/JDK-1.8.0_162-orange.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/xkcoding/simple-http/blob/master/LICENSE\" target=\"_blank\"\u003e\u003cimg alt=\"LICENSE\" src=\"https://img.shields.io/github/license/xkcoding/simple-http.svg\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## 简介\n\n\u003e 抽取一个简单 HTTP 的通用接口，底层实现根据具体引入依赖指定。\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.xkcoding.http\u003c/groupId\u003e\n  \u003cartifactId\u003esimple-http\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.5\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## 特点\n\n- 默认会按照下面的优先级自行寻找底层实现，`java 11 HttpClient -\u003e OkHttp3 -\u003e apache HttpClient -\u003e hutool-http`\n- 也可以自行实现 `com.xkcoding.http.support.Http` 接口，通过 `HttpUtil.setHttp(new MyHttpImpl())` 设置进来\n- 可以配置超时时间及代理\n```java\nHttpUtil.setConfig(HttpConfig.builder()\n\t\t\t.timeout(Constants.DEFAULT_TIMEOUT)\n\t\t\t.proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(\"127.0.0.1\", 10080)))\n\t\t\t.build());\nSimpleHttpResponse response = HttpUtil.get(\"https://www.google.com\");\nSystem.out.println(\"code = \" + response.getCode());\nSystem.out.println(\"body = \" + response.getBody());\n```\n\n## TODO\n\n- [x] ~~集成 JDK11 的 HTTPClient~~(感谢[@春哥](https://github.com/ChunMengLu)的 [PR#1](https://github.com/xkcoding/simple-http/pull/1))\n- [x] ~~支持代理~~(感谢[@亚东](https://github.com/zhangyd-c)的 [PR#7](https://github.com/xkcoding/simple-http/pull/7))\n- [x] ~~Response 封装~~(感谢[@小海](https://github.com/Mvbbb)的 [PR#11](https://github.com/xkcoding/simple-http/pull/11))\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxkcoding%2Fsimple-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxkcoding%2Fsimple-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxkcoding%2Fsimple-http/lists"}