New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LWP::UserAgent::put does not handle %form or @form as documented [rt.cpan.org #91250] #182

Open
oalders opened this Issue Mar 31, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@oalders
Member

oalders commented Mar 31, 2017

Migrated from rt.cpan.org#91250 (status was 'new')

Requestors:

Attachments:

From ian.goodacre@xtra.co.nz on 2013-12-08 19:29:12:

Documentation for LWP::UserAgent says:

$ua->put( $url, \%form )
$ua->put( $url, \@form )
$ua->put( $url, \%form, $field_name => $value, ... )
$ua->put( $url, $field_name => $value,... Content => \%form )
$ua->put( $url, $field_name => $value,... Content => \@form )
$ua->put( $url, $field_name => $value,... Content => $content )

    This method will dispatch a PUT request on the given $url, with %form or @form providing the key/value pairs for the fill-in form content. Additional headers and content options are the same as for the get() method.

    This method will use the PUT() function from HTTP::Request::Common to build the request. See HTTP::Request::Common for a details on how to pass form content and other advanced features.

But the forms with \%form or \@form do not work: the content isn't generated. This is because they use HTTP::Request::Common PUT to build the request and PUT doesn't accept the content as a reference.

Attached is a patch to HTTP::Request::Common to make PUT accept content as POST does. With this patch, LWP::UserAgent::put works as documented.

Enhancing HTTP::Request::Common seems a better solution than fixing LWP::UserAgent directly as it would be necessary to duplicate non-trivial function to do the latter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment