Skip to content

Commit

Permalink
e2e: add url-encoding case
Browse files Browse the repository at this point in the history
And fixup the README, b/c
it was off when it came
to the path part.

Test plan:
* task test passes.
  • Loading branch information
jonaslu committed Dec 10, 2024
1 parent 1f3ef70 commit 7d60ad1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -485,15 +485,15 @@ This means that you can mix url-encoded text, half encoded text or unencoded tex
Example:
```
[Host]
https://localhost:8080/api/finance/ca$h
https://localhost:8080/download/file/dir with%20spaces # %20=<space>
[Query]
account=full of ca%24h # This is already url-encoded (%24 = $)
filename=filename with %24$ in it # %24=$
```

Will result in the URL:
```
https://localhost:8080/api/finance/ca%24h?account=full+of+ca%24h
https://localhost:8080/download/file/dir%20with%20spaces?filename=filename+with+%24%24+in+it
```

The only caveats is that ain cannot know if a plus sign (+) is an encoded space or an literal plus sign. In this case ain assumes a space and leave the plus sign as is.
Expand Down
13 changes: 13 additions & 0 deletions test/e2e/templates/ok-url-encoding-host-and-qps.ain
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Host]
https://localhost:8080/download/file/dir with%20spaces # %20=<space>

[Query]
filename=filename with %24$ in it # %24=$

[Backend]
curl

# args:
# - -p
# stdout: |
# curl 'https://localhost:8080/download/file/dir%20with%20spaces?filename=filename+with+%24%24+in+it'

0 comments on commit 7d60ad1

Please sign in to comment.