{"id":22419908,"url":"https://github.com/testertech/dive-into-wiremock","last_synced_at":"2026-01-07T00:22:20.143Z","repository":{"id":159879699,"uuid":"428058188","full_name":"TesterTech/dive-into-wiremock","owner":"TesterTech","description":"Code for the YouTube video: https://youtu.be/0fyGWhGN6y8","archived":false,"fork":false,"pushed_at":"2022-02-22T16:36:51.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T10:11:19.471Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TesterTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-11-14T22:40:23.000Z","updated_at":"2021-11-15T19:55:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"91da37d6-bd5e-4b6b-a8e3-e91ecb4c2b3e","html_url":"https://github.com/TesterTech/dive-into-wiremock","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TesterTech%2Fdive-into-wiremock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TesterTech%2Fdive-into-wiremock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TesterTech%2Fdive-into-wiremock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TesterTech%2Fdive-into-wiremock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TesterTech","download_url":"https://codeload.github.com/TesterTech/dive-into-wiremock/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245785711,"owners_count":20671631,"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":[],"created_at":"2024-12-05T16:17:06.039Z","updated_at":"2026-01-07T00:22:20.114Z","avatar_url":"https://github.com/TesterTech.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# dive-into-wiremock\nCode for the YouTube videos:\n- Part 1: https://youtu.be/0fyGWhGN6y8 \n- Part 2: https://www.youtube.com/watch?v=hUv2rpqd3KU\n\n## Getting started with WireMock\nThe easiest way is to run the JAR from command-line. To do that look at the WireMock docs under standalone (http://wiremock.org/docs/running-standalone/) and download the JAR file. Now from terminal (command-line) run the JAR file using the ```java -jar``` argument, for example ```java -jar wiremock-jre8-standalone-2.31.0.jar```.\n\nYou should see an ascii logo of WireMock and an indication of the port it's running at. \n\nNow you can interact with it using curl of a rest-client. The rest-client I'm using in the video is Insomnia REST client but you can use any other client. \n\n## Docker\n```docker pull wiremock/wiremock```\n```docker run -it --rm -p 8080:8080 wiremock/wiremock```\nNote: depending on your setup, you might want to call wiremock with sudo (like also in the video). \n\n\n## Add new mappings\n\nYou can post to ```\u003curl\u003e/__admin/mappings/new```\nfor example\n```\n{\n    \"request\": {\n        \"method\": \"GET\",\n        \"url\": \"/api/mytest\"\n    },\n    \"response\": {\n        \"status\": 200,\n        \"body\": \"More content\\n\"\n    }\n}\n```\nYou can also put the above snippet in the mappings dir.\n\n\n## Files as JSON body\n- Create a mapping and assign ```bodyFileName``` the value of the location of a JSON file. \n```\n{\n    \"request\": {\n        \"method\": \"GET\",\n        \"url\": \"/body-file\"\n    },\n    \"response\": {\n        \"status\": 200,\n        \"bodyFileName\": \"example.json\"\n    }\n}\n```\n\n## Running Wiremock and recoding \nIn part 2 video I show an example of the recorder where I show behavior that is not expected https://youtu.be/hUv2rpqd3KU?t=461 ... Later I saw that using the command as shown below indeed works as expected. \n```\njava -jar wiremock-jre8-standalone-2.31.0.jar --port 8080 \\\n  --proxy-all=\"http://example.mocklab.io\" \\\n  --record-mappings \\ \n  --verbose \n```\nSo use above command if you want to have rec and play. \n\n## Demo app \n- The demo app is based on the tutorial \n- https://github.com/miguelgrinberg/microblog/\n\n\n## References\n- WireMock http://wiremock.org\n- Insomnia Rest client https://insomnia.rest \n- WireMock on Docker Hub https://hub.docker.com/r/wiremock/wiremock\n- WireMock rec \u0026 play at the same time https://stackoverflow.com/questions/40743569/can-wiremock-play-and-record-be-used-at-the-same-time\n-\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftestertech%2Fdive-into-wiremock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftestertech%2Fdive-into-wiremock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftestertech%2Fdive-into-wiremock/lists"}