Source of standalone version of Wiremock
Source of jar: http://wiremock.org/docs/running-standalone/#command-line-options
How to Run
java -jar wiremock-standalone-2.13.0.jar --global-response-templating
Example request & response
http://localhost:8080/user/1
{ id: "1", login: "user1" }
http://localhost:8080/user/2?param=1
{ id: "2", login: "user2" }
http://localhost:8080/user/3?param1=lorem¶m2=ipsum
{ id: "3", login: "user3", param1: "lorem", param2: "ipsum" }
Files
mappings/getUser1.json
{ "request": { "urlPattern": "/user/1", "method": "GET" }, "response": { "status": 200, "headers": { "Content-Type" : "application/json" }, "body": "{\"id\": \"1\", \"login\": \"user1\"}" } }
mappings/getUser2.json
{ "request": { "urlPattern": "/user/2+?.*", "method": "GET" }, "response": { "status": 200, "headers": { "Content-Type" : "application/json" }, "body": "{\"id\": \"2\", \"login\": \"user2\"}" } }
mappings/getUser3.json
{ "request": { "urlPattern": "/user/[0-9]+?.*", "method": "GET" }, "response": { "status": 200, "headers": { "Content-Type" : "application/json" }, "body": "{\"id\": \"3\", \"login\": \"user3\", \"param1\": \"{{request.query.param1}}\", \"param2\": \"{{request.query.param2}}\" }" } }