wiremock服务器:通过GET请求request,通过请求参数,返回结果;
1,准备两个jar包: wiremock-body-transformer-1.1.6.jar wiremock-standalone-2.1.10.jar 2,命令行执行: java -cp "wiremock-body-transformer-1.1.6.jar;wiremock-2.1.10-standalone.jar" com.github.tomakehurst.wiremock.standalone.WireMockServerRunner --verbose --extensions com.opentable.extension.BodyTransformer -port 9090 mappings下文件: test.json文件内容如下: { "request": { "method": "GET", "urlPath": "/api" }, "response": { "status": 200, "body": "{"responseName": "$(name)"}", "headers": { "Content-Type": "application/json" }, "transformers": ["body-transformer"] } } 3,浏览器执行: http://localhost:9090/api?name=apple 4,返回内容: {"responseName": "apple"}