in reply to Re: POST file through REST::Client
in thread POST file through REST::Client [SOLVED]
You can use that solution in your module
pojsub postSnippetsFile { my ( $self, %options ) = @_; my $request = HTTP::Request::Common::POST( '', 'Content_Type' => 'form-data', 'Content' => [ file => [ $options{file} ] ], ); $request->authorization_basic($options{username},$options{password +}); #print Dumper $request; my $headers = { 'Content-Type' => $request->header('Content-Type'), "Authorization" => $request->header('Authorization'), }; my $body_content = $request->content; #print Dumper $headers,$body_content; $self->{_client}->POST( $options{url}, $body_content ,$headers ); #print $self->{_client}->responseCode(); return $self->{_client}->responseContent(); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: POST file through REST::Client
by thanos1983 (Parson) on Apr 11, 2018 at 13:33 UTC |
In Section
Seekers of Perl Wisdom