my $request = HTTP::Request::Common::POST( BOX,
[
Content_Type => 'form-data',
Authorization => "Bearer $token",
Content => [
attributes => $c, #encoded json
file => [ "$Bin/test.txt" ], #file_path
],
]
);
__________________________try 2_______________________________
sub build_json_request {
my ($url) = @_;
my $header = ['Authorization' => "Bearer $token", 'Content-Type' =
+> 'form-data'];
return HTTP::Request->new('POST', $url, $header, {attributes => $c
+, file=> [ "$Bin/upload.bak" ],} );
}
my $r = build_json_request (ENDPOINT );
my $res = $ua->request($r);
I am pro when comes to Perl but don't know how http post works.
Do I have to encode body params while passing.
and not sure if LWP::Useragent will fetch the file contain itself given the full file path or not.
Can you help me in get this working.