{"id":15350583,"url":"https://github.com/gaul/java-httpbin","last_synced_at":"2025-04-09T15:04:29.836Z","repository":{"id":36439935,"uuid":"153568923","full_name":"gaul/java-httpbin","owner":"gaul","description":"A Java-based HTTP server that lets you locally test your HTTP client, retry logic, streaming behavior, timeouts, etc. with the endpoints of httpbin.org","archived":false,"fork":false,"pushed_at":"2025-04-02T00:42:22.000Z","size":166,"stargazers_count":47,"open_issues_count":5,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T15:04:26.008Z","etag":null,"topics":["http","http-server","httpbin","java","testing"],"latest_commit_sha":null,"homepage":"","language":"Java","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/gaul.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":"2018-10-18T05:37:31.000Z","updated_at":"2025-04-02T00:42:19.000Z","dependencies_parsed_at":"2024-08-04T15:29:23.127Z","dependency_job_id":"548ebd89-a5c5-4ca8-9f57-27dc4d679be9","html_url":"https://github.com/gaul/java-httpbin","commit_stats":{"total_commits":205,"total_committers":7,"mean_commits":"29.285714285714285","dds":"0.47804878048780486","last_synced_commit":"0d4a5b4227b25f96c252f4cfdcbc4c33d7578d20"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaul%2Fjava-httpbin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaul%2Fjava-httpbin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaul%2Fjava-httpbin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaul%2Fjava-httpbin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gaul","download_url":"https://codeload.github.com/gaul/java-httpbin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055276,"owners_count":21040156,"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","http-server","httpbin","java","testing"],"created_at":"2024-10-01T11:58:45.024Z","updated_at":"2025-04-09T15:04:29.818Z","avatar_url":"https://github.com/gaul.png","language":"Java","readme":"# Java httpbin\n\n[![Build Status](https://travis-ci.org/gaul/java-httpbin.svg?branch=master)](https://travis-ci.org/gaul/java-httpbin)\n[![Maven Central](https://img.shields.io/maven-central/v/org.gaul/httpbin.svg)](https://search.maven.org/#search%7Cga%7C1%7Ca%3A%22httpbin%22)\n\nA Java-based HTTP server that lets you locally test your HTTP client, retry\nlogic, streaming behavior, timeouts, etc. with the endpoints of\n[httpbin.org](https://httpbin.org/).\n\nThis way, you can write tests without relying on an external dependency like\nhttpbin.org.\n\n## Endpoints\n\nJava httpbin supports a subset of httpbin endpoints:\n\n- `/ip` Returns Origin IP.\n- `/user-agent` Returns user-agent.\n- `/headers` Returns headers.\n- `/delete` Returns DELETE data.\n- `/get` Returns GET data.\n- `/patch` Returns PATCH data.\n- `/post` Returns POST data.\n- `/put`  Returns PUT data.\n- `/anything` Returns anything passed in request data.\n- `/status/:code` Returns given HTTP Status code.\n- `/redirect/:n` 302 Redirects _n_ times.\n- `/relative-redirect/:n` 302 Redirects _n_ times.\n- `/absolute-redirect/:n` 302 Absolute redirects _n_ times.\n- `/redirect-to?url=foo` 302 Redirects to the _foo_ URL.\n- `/stream/:n` Streams _n_ lines of JSON objects.\n- `/stream-bytes/:n?chunkSize=c\u0026seed=s` Streams _n_ bytes.\n- `/delay/:n` Delays responding for _min(n, 10)_ seconds.\n- `/bytes/:n` Generates _n_ random bytes of binary data, accepts optional _seed_ integer parameter.\n- `/base64/:s` Returns a base64 decoded :s input\n- `/range/:s` Return a subset of data based on Content-range header.\n- `/cookies` Returns the cookies.\n- `/cookies/set?name=value` Sets one or more simple cookies.\n- `/cookies/delete?name` Deletes one or more simple cookies.\n- `/drip?numbytes=n\u0026duration=s\u0026delay=s\u0026code=code` Drips data over a duration after\n  an optional initial _delay_, then optionally returns with the given status _code_.\n- `/cache` Returns 200 unless an If-Modified-Since or If-None-Match header is provided, when it returns a 304.\n- `/cache/:n` Sets a Cache-Control header for _n_ seconds.\n- `/etag` Return 200 when If-Match or If-None-Match succeed.\n- `/gzip` Returns gzip-encoded data.\n- `/deflate` Returns deflate-encoded data.\n- `/robots.txt` Returns some robots.txt rules.\n- `/deny` Denied by robots.txt file.\n- `/basic-auth/:user/:passwd` Challenges HTTP Basic Auth.\n- `/hidden-basic-auth/:user/:passwd` Challenges HTTP Basic Auth and returns 404 on failure.\n- `/html` Returns some HTML.\n- `/xml` Returns some XML.\n- `/image/png` Returns page containing a PNG image.\n- `/image/jpeg` Returns page containing a JPEG image.\n\n## Usage\n\nFirst add dependency to `pom.xml`:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.gaul\u003c/groupId\u003e\n  \u003cartifactId\u003ehttpbin\u003c/artifactId\u003e\n  \u003cversion\u003e1.4.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nThen add to your test code:\n\n```java\nprivate URI httpBinEndpoint = URI.create(\"http://127.0.0.1:0\");\nprivate final HttpBin httpBin = new HttpBin(httpBinEndpoint);\n\n@Before\npublic void setUp() throws Exception {\n    httpBin.start();\n\n    // reset endpoint to handle zero port\n    httpBinEndpoint = new URI(httpBinEndpoint.getScheme(),\n            httpBinEndpoint.getUserInfo(), httpBinEndpoint.getHost(),\n            httpBin.getPort(), httpBinEndpoint.getPath(),\n            httpBinEndpoint.getQuery(), httpBinEndpoint.getFragment());\n}\n\n@After\npublic void tearDown() throws Exception {\n    httpBin.stop();\n}\n\n@Test\npublic void test() throws Exception {\n    URI uri = URI.create(httpBinEndpoint + \"/status/200\");\n    HttpURLConnection conn = (HttpURLConnection) uri.toURL().openConnection();\n    assert conn.getResponseCode() == 200;\n}\n```\n\n## References\n\n* [httpbin](https://httpbin.org/) - original Python implementation\n* [go-httpbin](https://github.com/ahmetb/go-httpbin) - Go reimplementation\n\n## License\n\nCopyright (C) 2018-2023 Andrew Gaul\u003cbr /\u003e\nCopyright (C) 2015-2016 Bounce Storage\n\nLicensed under the Apache License, Version 2.0\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaul%2Fjava-httpbin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgaul%2Fjava-httpbin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaul%2Fjava-httpbin/lists"}