Navigation Menu

Skip to content

Commit

Permalink
mention the new content generator in the cookbook too
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 3, 2017
1 parent 5407815 commit 811a719
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/Mojo/UserAgent/Transactor.pm
Expand Up @@ -221,10 +221,10 @@ sub _multipart_form {
}

sub _parts {
my ($self, $charset, $name, $parts) = @_;
my ($self, $charset, $name, $values) = @_;

my @parts;
for my $value (@$parts) {
for my $value (@$values) {
push @parts, my $part = Mojo::Content::Single->new;

my $filename;
Expand Down Expand Up @@ -337,8 +337,8 @@ L<Mojo::UserAgent::Transactor> implements the following attributes.
my $generators = $t->generators;
$t = $t->generators({foo => sub {...}});
Registered content generators, by default only C<form> and C<json> are already
defined.
Registered content generators, by default only C<form>, C<json> and C<multipart>
are already defined.
=head2 name
Expand Down
5 changes: 4 additions & 1 deletion lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -1110,7 +1110,7 @@ content repeatedly for multiple requests.
$ua->put('http://example.com/upload' => stream => '/home/sri/mojo.png');
$ua->post('http://example.com/upload' => stream => '/home/sri/minion.png');

The C<json> and C<form> content generators are always available.
The C<json>, C<form> and C<multipart> content generators are always available.

use Mojo::UserAgent;

Expand All @@ -1128,6 +1128,9 @@ The C<json> and C<form> content generators are always available.
my $tx4 = $ua->put('http://upload.example.com' =>
form => {test => {content => 'Hello World!'}});

# Send custom multipart content via PUT
my $tx5 = $ua->put('http://api.example.com' => multipart => ['Hello World!']);

For more information about available content generators see also
L<Mojo::UserAgent::Transactor/"tx">.

Expand Down

0 comments on commit 811a719

Please sign in to comment.