Julio Marvim
11/07/2023, 6:33 PM{
"mappings": [
{
"name": "Mock error 400: 'code' is not provided",
"requet": {
"method": "POST",
"url": "/as/token.oauth2",
"bodyPatterns": [
{
"contains":"grant_type=client_credentials",
"notContain":"code="//how to make this??
}
]
},
"response": {
"bodyFileName": "token-400-response.json",
"status": 400
}
}
]
}
I don't know if this is important but these parameters are passed using: x-www-form-urlencoded
Dirk Bolte
11/07/2023, 8:53 PMformParameters
:
"formParameters": {
"tool": {
"equalTo": "WireMock"
}
}
I don't know whether there is a matcher for `exists`/`doesNotExist` but you may be able mimic this with `doesNotMatch`:
"formParameters": {
"code": {
"doesNotMatch": ".+"
}
}
Julio Marvim
11/07/2023, 9:15 PM"form parameters": {
"code": {
"doesNotMatch": ".+"
}
}
I don't know if I did something wrong: but I'm getting the following error:
Unrecognized field "formParameters" (class com.github.tomakehurst.wiremock.matching.RequestPattern), not marked as ignorable
Aaron
11/07/2023, 10:36 PM"formParameters": {
"grant_type": {
"equalTo": "authorization_code"
},
"code": {
"absent": true
}
}
Should workformParameters
is only in Wiremock 3 and aboveJulio Marvim
11/08/2023, 5:01 PM"formParameters": {
"grant_type": {
"equalTo": "authorization_code"
},
"code": {
"absent": true
}
}
But I needed to update the version of the wiremock I was using to the latest version available.
Thank you very much.