Skip to content

Commit

Permalink
better form generator examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 28, 2012
1 parent abebf03 commit 1b97d48
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/Mojo/UserAgent/Transactor.pm
Expand Up @@ -295,12 +295,16 @@ Actual endpoint for transaction.
Versatile L<Mojo::Transaction::HTTP> builder for C<POST> requests with form
data.
# Inspect generated request
say $t->form('mojolicio.us' => {a => [1, 2, 3]})->req->to_string;
# Multipart upload with filename
my $tx = $t->form(
'mojolicio.us' => {fun => {content => 'Hello!', filename => 'test.txt'}});
# Streaming multipart file upload
# Multipart upload streamed from file
my $tx = $t->form('mojolicio.us' => {fun => {file => '/etc/passwd'}});
# Inspect generated request
say $t->form('mojolicio.us' => {a => [1, 2], b => 3})->req->to_string;
While the "multipart/form-data" content type will be automatically used
instead of "application/x-www-form-urlencoded" when necessary, you can also
enforce it by setting the header manually.
Expand Down

0 comments on commit 1b97d48

Please sign in to comment.