Allow the creation of requestBody #247
-
|
When variation testing, I would like to test my GET endpoints correctly reject requests that contain a requestBody. I have a overwriteRequestBody overwrite enabled but it is not possible to create new objects / add objects to a body, only overwrite existing properties: {
"openApiOperation": "GET::/*",
"openApiResponse": "400",
"variations": [
{
"name": "getWithBody",
"overwrites": [
{
"overwriteRequestBody": [
{
"key": "firstName",
"value": "foo",
"overwrite": true
}
]
}
],
"tests": {
"contractTests": [
{
"statusCode": {
"enabled": true
},
"schemaValidation": {
"enabled": true,
"additionalProperties": false
},
"contentType": {
"enabled": true
}
}
]
}
}Is this something that would be useful to add? (Note we can and do insert new query params in the same way to ensure unknown query params are rejected |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
|
@savage-alex {
"key": ".",
"value": { "foo": "foo-bar-baz" }
}In the Portman, you can see some examples in the tests |
Beta Was this translation helpful? Give feedback.

@savage-alex
If things work as expected, you can overwrite the request body, where by using "." as
keythis targets the root element.As as
valueyou can set an single value (like a string, number, ...) or a full object ({}) or an array ([]){ "key": ".", "value": { "foo": "foo-bar-baz" } }In the Portman, you can see some examples in the tests