Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: http header

by nikosv (Deacon)
on May 08, 2017 at 06:54 UTC ( [id://1189783]=note: print w/replies, xml ) Need Help??


in reply to http header

Since HTTP::Tinyish is a wrapper over LWP, why not go with LWP directly?

my $browser = LWP::UserAgent->new();

my $header = HTTP::Headers->new(
                      Content_Type        => 'application/json',           
                      'api-key'=>"jhtty657");
                      #or maybe apikey=>"jhtty657" without the dash?

$url="https://somewhere.com";


$req = HTTP::Request->new( POST, $url, $header);
$req->content($data);

my $response=$browser->request($req);


Replies are listed 'Best First'.
Re^2: http header
by tobyink (Canon) on May 08, 2017 at 08:59 UTC

    Maybe because it's not a wrapper around LWP. It's an HTTP class that chooses between several backend implementations, one of which is LWP. There's no guarantee that LWP is installed on the OP's machine.

      "This module can be useful in a restrictive environment where you need to be able to download CPAN modules without an HTTPS support in built-in HTTP library."

      Get a better job then. :) No really. :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1189783]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-26 03:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found