【发布时间】:2018-04-04 23:21:33
【问题描述】:
我希望我的协议服务器在使用 Header Content-Type: application/x-www-form-urlencoded 进行 POST 调用时返回自定义响应。
但是,POST 调用的主体并不总是相同的,只有一个前缀保持不变。
例如,无论我用 bodyinput_text=LOGSomeStuffHERE 还是用input_text=LOGAnoutherStuff
调用它,它都必须返回相同的东西(如您所见,input_text=LOG 是常量部分)
这是我尝试过的:
.uponReceiving("POST cusom body")
.path("/path")
.method("POST")
.headers(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_FORM_URLENCODED.getMimeType())
.body("input_text=LOG*")
.willRespondWith()
.status(200)
...
PactDsl 是否支持请求部分的某种正文匹配?
【问题讨论】:
-
我也尝试过使用
.body(new PactDslJsonBody()...),但这也不起作用,因为请求的Content-Type不是aplication/json
标签: java integration-testing pact pact-jvm