Skip to content

Commit

Permalink
Add --form-escape option
Browse files Browse the repository at this point in the history
Currently this does not seem to make any kind of difference in handling
between Curl and the Perl modules. Maybe they are identical in behaviour.
  • Loading branch information
Max Maischein committed Oct 22, 2023
1 parent 8c1d397 commit 99b6825
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/HTTP/Request/FromCurl.pm
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ our @option_spec = (
'dump-header|D=s', # ignored
'referrer|e=s',
'form|F=s@',
'form-escape!',
'form-string=s@',
'get|G',
'globoff|g',
Expand Down
27 changes: 27 additions & 0 deletions t/curl-identity-data.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,33 @@ my @tests = (
version => 7043000 },
{ cmd => [ '--verbose', '-g', '-s', '--data-urlencode', '@$tempfile', '$url' ],
version => 7018000 },

{ cmd => [ '--verbose', '-g', '-s', '--form-string', 'foo=bar', '$url' ],
},

{ cmd => [ '--verbose', '-g', '-s', '--form-escape',
#'-H', 'Content-Type: multipart/form-data',
'--form-string', "field1 name=bar\"",
'--form-string', "field2\\name=baz\"",
'--form-string', "field3%20name=bat+",
'$url' ],
version => 7081000 },

{ cmd => [ '--verbose', '-g', '-s', '--form-escape',
'-H', 'Content-Type: multipart/form-data',
'--form-string', "field1 name=bar\"",
'--form-string', "field2\\name=baz\"",
'--form-string', "field3%20name=bat+",
'$url' ],
version => 7081000 },

{ cmd => [ '--verbose', '-g', '-s', '--no-form-escape',
'--form-string', "field1 name=bar\"",
'--form-string', "field2\\name=baz\"",
'--form-string', "field3%20name=bat+",
'$url' ],
version => 7081000 },

);

run_curl_tests( @tests );

0 comments on commit 99b6825

Please sign in to comment.