Contents

wiremock 反向代理方法

Contents

最近寫好 mock api 完後,剛好開發環境也完成了
想直接在本機測試
想說 wiremock 有沒有反向代理方法
結果還真的有耶!!

先前文章有用過

Proxying - WireMock

1
2
3
4
5
6
7
8
9
{
    "request": {
        "method": "ANY",
        "urlPattern": "/project/.*"
    },
    "response": {
        "proxyBaseUrl" : "http://localhost:8080/"
    }
}

Stubbing - WireMock

HTTP methods currently supported are: GET, POST, PUT, DELETE, HEAD, TRACE, OPTIONS. You can specify ANY if you want the stub mapping to match on any request method.

未來有空來寫寫看 Rand 非特定字串(如:UUID,TOKEN之類的)

Rand

http://wiremock.org/docs/response-templating/