-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix powershell test cases for in-depth escaping scenario
This also handles a few other cases not specifically covered by the new scenario but which are obviously easily fixable
- Loading branch information
Showing
26 changed files
with
83 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
test/fixtures/output/powershell/restmethod/application-form-encoded.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
$headers=@{} | ||
$headers.Add("content-type", "application/x-www-form-urlencoded") | ||
$headers.Add('content-type', 'application/x-www-form-urlencoded') | ||
$response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'application/x-www-form-urlencoded' -Body 'foo=bar&hello=world' |
2 changes: 1 addition & 1 deletion
2
test/fixtures/output/powershell/restmethod/application-json.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
$headers=@{} | ||
$headers.Add("content-type", "application/json") | ||
$headers.Add('content-type', 'application/json') | ||
$response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'application/json' -Body '{"number":1,"string":"f\"oo","arr":[1,2,3],"nested":{"a":"b"},"arr_mix":[1,"a",{"arr_mix_nested":{}}],"boolean":false}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
$headers=@{} | ||
$headers.Add("accept-encoding", "deflate, gzip, br") | ||
$headers.Add('accept-encoding', 'deflate, gzip, br') | ||
$response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -Method GET -Headers $headers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
$headers=@{} | ||
$headers.Add("accept", "application/json") | ||
$headers.Add("x-foo", "Bar") | ||
$headers.Add("quoted-value", "`"quoted`" 'string'") | ||
$headers.Add('accept', 'application/json') | ||
$headers.Add('x-foo', 'Bar') | ||
$headers.Add('quoted-value', '"quoted" ''string''') | ||
$response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -Method GET -Headers $headers |
2 changes: 1 addition & 1 deletion
2
test/fixtures/output/powershell/restmethod/jsonObj-multiline.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
$headers=@{} | ||
$headers.Add("content-type", "application/json") | ||
$headers.Add('content-type', 'application/json') | ||
$response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'application/json' -Body '{ | ||
"foo": "bar" | ||
}' |
2 changes: 1 addition & 1 deletion
2
test/fixtures/output/powershell/restmethod/jsonObj-null-value.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
$headers=@{} | ||
$headers.Add("content-type", "application/json") | ||
$headers.Add('content-type', 'application/json') | ||
$response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'application/json' -Body '{"foo":null}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
$headers=@{} | ||
$headers.Add('squote-value-test', '''') | ||
$headers.Add('dquote-value-test', '"') | ||
$headers.Add('backtick-value-test', '`') | ||
$headers.Add('dollar-parenthesis-value-test', '$(') | ||
$headers.Add('hash-brace-value-test', '#{') | ||
$headers.Add('percent-parenthesis-value-test', '%(') | ||
$headers.Add('percent-brace-value-test', '%{') | ||
$headers.Add('double-brace-value-test', '{{') | ||
$headers.Add('null-value-test', '\0') | ||
$headers.Add('string-fmt-value-test', '%s') | ||
$headers.Add('slash-value-test', '\') | ||
$response = Invoke-RestMethod -Uri 'http://example.test/%27%22%60$(%(%%7B%7B%7B/0%s//?''=squote-key-test&squote-value-test=''&%22=dquote-key-test&dquote-value-test=%22&%60=backtick-key-test&backtick-value-test=%60&%24(=dollar-parenthesis-key-test&dollar-parenthesis-value-test=%24(&%23%7B=hash-brace-key-test&hash-brace-value-test=%23%7B&%25(=percent-parenthesis-key-test&percent-parenthesis-value-test=%25(&%25%7B=percent-brace-key-test&percent-brace-value-test=%25%7B&%7B%7B=double-brace-key-test&double-brace-value-test=%7B%7B&%5C0=null-key-test&null-value-test=%5C0&%25s=string-fmt-key-test&string-fmt-value-test=%25s&%5C=slash-key-test&slash-value-test=%5C' -Method POST -Headers $headers -Body ''' " ` $( #{ %( %{ {{ \0 %s \' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
test/fixtures/output/powershell/restmethod/multipart-form-data.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
$headers=@{} | ||
$headers.Add("content-type", "text/plain") | ||
$headers.Add('content-type', 'text/plain') | ||
$response = Invoke-RestMethod -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'text/plain' -Body 'Hello World' |
2 changes: 1 addition & 1 deletion
2
test/fixtures/output/powershell/webrequest/application-form-encoded.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
$headers=@{} | ||
$headers.Add("content-type", "application/x-www-form-urlencoded") | ||
$headers.Add('content-type', 'application/x-www-form-urlencoded') | ||
$response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'application/x-www-form-urlencoded' -Body 'foo=bar&hello=world' |
2 changes: 1 addition & 1 deletion
2
test/fixtures/output/powershell/webrequest/application-json.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
$headers=@{} | ||
$headers.Add("content-type", "application/json") | ||
$headers.Add('content-type', 'application/json') | ||
$response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'application/json' -Body '{"number":1,"string":"f\"oo","arr":[1,2,3],"nested":{"a":"b"},"arr_mix":[1,"a",{"arr_mix_nested":{}}],"boolean":false}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
$headers=@{} | ||
$headers.Add("accept-encoding", "deflate, gzip, br") | ||
$headers.Add('accept-encoding', 'deflate, gzip, br') | ||
$response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -Method GET -Headers $headers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
$headers=@{} | ||
$headers.Add("accept", "application/json") | ||
$headers.Add("x-foo", "Bar") | ||
$headers.Add("quoted-value", "`"quoted`" 'string'") | ||
$headers.Add('accept', 'application/json') | ||
$headers.Add('x-foo', 'Bar') | ||
$headers.Add('quoted-value', '"quoted" ''string''') | ||
$response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -Method GET -Headers $headers |
2 changes: 1 addition & 1 deletion
2
test/fixtures/output/powershell/webrequest/jsonObj-multiline.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
$headers=@{} | ||
$headers.Add("content-type", "application/json") | ||
$headers.Add('content-type', 'application/json') | ||
$response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'application/json' -Body '{ | ||
"foo": "bar" | ||
}' |
2 changes: 1 addition & 1 deletion
2
test/fixtures/output/powershell/webrequest/jsonObj-null-value.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
$headers=@{} | ||
$headers.Add("content-type", "application/json") | ||
$headers.Add('content-type', 'application/json') | ||
$response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'application/json' -Body '{"foo":null}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
$headers=@{} | ||
$headers.Add('squote-value-test', '''') | ||
$headers.Add('dquote-value-test', '"') | ||
$headers.Add('backtick-value-test', '`') | ||
$headers.Add('dollar-parenthesis-value-test', '$(') | ||
$headers.Add('hash-brace-value-test', '#{') | ||
$headers.Add('percent-parenthesis-value-test', '%(') | ||
$headers.Add('percent-brace-value-test', '%{') | ||
$headers.Add('double-brace-value-test', '{{') | ||
$headers.Add('null-value-test', '\0') | ||
$headers.Add('string-fmt-value-test', '%s') | ||
$headers.Add('slash-value-test', '\') | ||
$response = Invoke-WebRequest -Uri 'http://example.test/%27%22%60$(%(%%7B%7B%7B/0%s//?''=squote-key-test&squote-value-test=''&%22=dquote-key-test&dquote-value-test=%22&%60=backtick-key-test&backtick-value-test=%60&%24(=dollar-parenthesis-key-test&dollar-parenthesis-value-test=%24(&%23%7B=hash-brace-key-test&hash-brace-value-test=%23%7B&%25(=percent-parenthesis-key-test&percent-parenthesis-value-test=%25(&%25%7B=percent-brace-key-test&percent-brace-value-test=%25%7B&%7B%7B=double-brace-key-test&double-brace-value-test=%7B%7B&%5C0=null-key-test&null-value-test=%5C0&%25s=string-fmt-key-test&string-fmt-value-test=%25s&%5C=slash-key-test&slash-value-test=%5C' -Method POST -Headers $headers -Body ''' " ` $( #{ %( %{ {{ \0 %s \' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
test/fixtures/output/powershell/webrequest/multipart-form-data.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
$headers=@{} | ||
$headers.Add("content-type", "text/plain") | ||
$headers.Add('content-type', 'text/plain') | ||
$response = Invoke-WebRequest -Uri 'http://mockbin.com/har' -Method POST -Headers $headers -ContentType 'text/plain' -Body 'Hello World' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters