Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rfc: Define matching rules for form-urlencoded body #99

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions rfc/0000-define-matching-rules-for-form-urlencoded-body.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,34 @@ pactffi_with_body(interaction, InteractionPart::Request, "application/x-www-form

The values are ignored. Unsupported error messages are logged. The extracted example body will be empty.

### Special cases

- keys with no values (`a=&b=&c=`): can be achieved by define empty string value
- values with no keys (`=a&=b&=c`): can't be achieved because empty key is not supported and will be ignored
- repeated keys: (`a=1&a=2` or `a=2&a=1`): can be achieved by define array values
- special characters
- `/`: will be encoded to `%2F`
- `&`: will be encoded to `%26`
- `?`: will be encoded to `%3F`
- `=`: will be encoded to `%3D`
- only ampersands (`&&&`)
- can't be defined by json
- can be defined by raw syntax
- these query strings can match it:
- `&`
- `&&`
- `&&&`
- ...
- empty string can't match it
- only equals signs (`===`)
- can't be defined by json
- can be defined by raw syntax
- these query strings can match it:
- `===`
- `=%3D%3D`
- empty string can't match it
- no key and value (`=&=&=`): can't be achieved because empty key is not supported and will be ignored

tienvx marked this conversation as resolved.
Show resolved Hide resolved
## Reference-level explanation

Here is the flow we need to implement in Rust core (pact-reference project):
Expand Down