HTTP::Tiny::FromHTTPRequest - Perform a request based on a plain HTTP request or HTTP::Request object
version 0.02
use v5.10; use HTTP::Tiny::FromHTTPRequest; use HTTP::Request; my $http = HTTP::Tiny::FromHTTPRequest->new; my $plain_request = q~ POST / HTTP/1.1 Content-Length: 104 User-Agent: HTTP-Tiny/0.025 Content-Type: multipart/form-data; boundary=go7DX Connection: close Host: localhost:3000 --go7DX Content-Disposition: form-data; name="file"; filename="test.txt" This is a test --go7DX-- ~; my $response_from_object = $http->request( HTTP::Request->parse( $plain_request ) ); if ( $response_from_object->{success} ) { say "Successful request from HTTP::Request object"; } my $response_from_plain = $http->request( $plain_request ); if ( $response_from_plain->{success} ) { say "Successful request from plain HTTP request"; }
Renee Baecker <reneeb@cpan.org>
This software is Copyright (c) 2018 by Renee Baecker.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install HTTP::Tiny::FromHTTPRequest, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTTP::Tiny::FromHTTPRequest
CPAN shell
perl -MCPAN -e shell install HTTP::Tiny::FromHTTPRequest
For more information on module installation, please visit the detailed CPAN module installation guide.