Skip to content

Commit e21067e

Browse files
committed
Manually define URI for input
Signed-off-by: Sebitosh <[email protected]>
1 parent 9a4d1d1 commit e21067e

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,25 @@ The field `input.encoded_request` allows defining a whole request encoded in bas
454454
encoded_request: R0VUIC8gSFRUUC8xLjENCkhvc3Q6IGxvY2FsaG9zdA0KDQo=
455455
```
456456

457+
#### Uri
458+
459+
The field `input.uri` allows defining the uri used for the request manually. This is in particular useful for using the `/reflect` endpoint of [albedo](https://github.com/coreruleset/albedo) which allows defining what the server response should be from within the body of the post request that was sent.
460+
461+
```yaml
462+
targets:
463+
- target: ''
464+
test:
465+
data: '{"status": 201, "body": "<html>reflected-token</html>"}'
466+
input:
467+
headers:
468+
- name: Content-Type
469+
value: application/json
470+
uri: '/reflect'
471+
output:
472+
status: 201
473+
response_contains: "reflected-token"
474+
```
475+
457476
### Constants
458477
The yaml schema has a mechanism to handle global and local constants.
459478

mrts/generate-rules.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ def genrulefromtemplate(self, tpl, current_confdata):
312312
item['stages'][0]['input']['headers'][h['name']] = h['value']
313313
if 'encoded_request' in test['test']['input']:
314314
item['stages'][0]['input']['encoded_request'] = test['test']['input']['encoded_request']
315+
if 'uri' in test['test']['input']:
316+
item['stages'][0]['input']['uri'] = test['test']['input']['uri']
315317
# overwrite default output field
316318
if 'output' in test['test']:
317319
item['stages'][0]['output'] = test['test']['output']

0 commit comments

Comments
 (0)