When configured as queries parameter, only the parameters in the configuration need to be matched when calling, and the test can pass.
config: [{"request":{"uri":"/test","queries":{"key":"test1"}},"response":{"text":"success"}}]
test: curl http://ip:12305/test?key=test1&name=a
When configured as a json parameter, all parameters in the body json need to be matched when calling to pass the test, otherwise the test will not pass.
config: [{"request":{"uri":"/test","json":{"key":"test1"}},"response":{"text":"success"}}]
When configured as queries parameter, only the parameters in the configuration need to be matched when calling, and the test can pass. config: [{"request":{"uri":"/test","queries":{"key":"test1"}},"response":{"text":"success"}}] test: curl http://ip:12305/test?key=test1&name=a
When configured as a json parameter, all parameters in the body json need to be matched when calling to pass the test, otherwise the test will not pass. config: [{"request":{"uri":"/test","json":{"key":"test1"}},"response":{"text":"success"}}]
test1, pass curl -X POST http://ip:12305/test -H "Content-type: application/json" -d' { "key": "test1" } '
test2, fail curl -X POST http://ip:12305/test -H "Content-type: application/json" -d' { "key": "test1", "name": "a" } '
How can I make json parameters like queries parameters and pass the test only if they match the parameters in the configuration?