{"id":15698040,"url":"https://github.com/mike10004/har-replay","last_synced_at":"2025-05-08T22:43:49.948Z","repository":{"id":17277770,"uuid":"81611630","full_name":"mike10004/har-replay","owner":"mike10004","description":"Java library for serving recorded HTTP responses from a HAR file.","archived":false,"fork":false,"pushed_at":"2022-11-16T00:42:43.000Z","size":1128,"stargazers_count":7,"open_issues_count":12,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-08T22:43:43.498Z","etag":null,"topics":["har","http","java"],"latest_commit_sha":null,"homepage":null,"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/mike10004.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":"2017-02-10T22:10:25.000Z","updated_at":"2024-05-09T22:06:48.000Z","dependencies_parsed_at":"2022-09-06T04:40:48.204Z","dependency_job_id":null,"html_url":"https://github.com/mike10004/har-replay","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mike10004%2Fhar-replay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mike10004%2Fhar-replay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mike10004%2Fhar-replay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mike10004%2Fhar-replay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mike10004","download_url":"https://codeload.github.com/mike10004/har-replay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253160727,"owners_count":21863624,"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":["har","http","java"],"created_at":"2024-10-03T19:22:55.093Z","updated_at":"2025-05-08T22:43:49.917Z","avatar_url":"https://github.com/mike10004.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Travis build status](https://travis-ci.org/mike10004/har-replay.svg?branch=master)](https://travis-ci.org/mike10004/har-replay)\n[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/tfhj96elsi8ytf82?svg=true)](https://ci.appveyor.com/project/mike10004/har-replay)\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.mike10004/har-replay.svg)](https://repo1.maven.org/maven2/com/github/mike10004/har-replay/)\n\nhar-replay\n==========\n\nJava library and executable for serving recorded HTTP responses from a HAR \nfile. To use it, you provide a HAR file, the library instantiates an HTTP\nproxy server, and you configure your web browser to use the proxy server. \nThe proxy intercepts each request and responds with the corresponding \npre-recorded response from the HAR.\n\nQuick Start\n-----------\n\n### Package\n\nLook in https://repo1.maven.org/maven2/com/github/mike10004/har-replay-dist \nfor the latest `.deb` file or build the parent project to produce one. Execute\n\n    $ sudo dpkg --install /path/to/har-replay-deb  \n\nto install the package. (Replace the filename with the downloaded file or the \nbuild product.) \n\nExecute\n\n    $ har-replay --port 56789 /path/to/my.har\n\nto start an HTTP proxy on port 56789 serving responses from `/path/to/my.har`.\n\n### Library\n\nMaven dependency:\n\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.github.mike10004\u003c/groupId\u003e\n        \u003cartifactId\u003ehar-replay-vhs\u003c/artifactId\u003e\n        \u003cversion\u003e0.26\u003c/version\u003e \u003c!-- use latest version --\u003e\n    \u003c/dependency\u003e\n\nSee Maven badge above for the actual latest version. Example code:\n\n    File harFile = new File(\"my-session.har\");\n    ReplaySessionConfig sessionConfig = ReplaySessionConfig.usingTempDir().build(harFile);\n    VhsReplayManagerConfig config = VhsReplayManagerConfig.getDefault();\n    ReplayManager replayManager = new VhsReplayManager(config);\n    try (ReplaySessionControl sessionControl = replayManager.start(sessionConfig)) {\n        URL url = new URL(\"http://www.example.com/\");\n        Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(\"localhost\", sessionControl.getListeningPort()));\n        HttpURLConnection conn = (HttpURLConnection) url.openConnection(proxy);\n        try {\n            System.out.format(\"served from HAR: %s %s %s%n\", conn.getResponseCode(), conn.getResponseMessage(), url);\n            // do something with the connection...\n        } finally {\n            conn.disconnect();\n        }\n    }\n\n(Imports are from the library and the `java.net` package.)\n\nThe unit tests contain some examples of using the library with an Apache HTTP \nclient and a Selenium Chrome WebDriver client. \n\nFAQ\n---\n\n### How do I create a HAR?\n\nSee https://toolbox.googleapps.com/apps/har_analyzer/ for instructions on using\nyour web browser to create a HAR file. Another option is to use \n[browsermob-proxy](https://github.com/lightbody/browsermob-proxy) to capture a\nHAR. The Browsermob method captures some requests the web browser hides from you\n(because they are trackers or fetch data for browser internals).\n\nDebugging Travis Builds\n-----------------------\n\nIf the Travis build is failing, you can test locally with Docker by running \n`./travis-debug.sh`. However, the `mvn verify` command appears to exit early \nbut does not report a nonzero exit code, so it's not clear whether it's \nactually succeeding or something funky is going on. It should be useful for \ndebugging failures that happen earlier, though. If the failure you see on \nTravis happens later on in `mvn verify`, you can follow the Travis\n[Troubleshooting in a local container](https://docs.travis-ci.com/user/common-build-problems/)\ninstructions, which say to execute:\n\n    $ docker run --name travis-debug -dit $TRAVIS_IMAGE /sbin/init\n    $ docker exec -it travis-debug bash -l \n\nThis puts you inside the container, where you can `su -l travis`, clone the \nrepo, and proceed manually from there.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmike10004%2Fhar-replay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmike10004%2Fhar-replay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmike10004%2Fhar-replay/lists"}