HTTP::...ltipart(3pm)
π HTTP::Tiny::Multipart β the manual, but make it slay π
okay bestie, so this is the User Contributed Perl Documentation for HTTP::Tiny::Multipart β a lil' module that gives your fave tiny HTTP client a whole new trick. Pull up a chair, we're doing this together π«Ά
β¨ NAME β¨
HTTP::Tiny::Multipart β it adds post_multipart to HTTP::Tiny. that's it, that's the whole vibe. no cap.
πΈ VERSION πΈ
version 0.08
(yeah, she's on 0.08, respect the journey π
)
π¦ SYNOPSIS π¦
okay so first thing first, load both of them up:
use HTTP::Tiny;
use HTTP::Tiny::Multipart;
my $http = HTTP::Tiny->new;
my $content = "This is a test";
my $response = $http->post_multipart( 'http://localhost:3000/', {
file => {
filename => 'test.txt',
content => $content,
}
} );
and this is the request it creates. look at it. it's giving multipart. it's giving boundary=go7DX:
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--
And also β this one here, where we're adding a content_type to the file AND a plain testfield alongside it:
use HTTP::Tiny;
use HTTP::Tiny::Multipart;
my $http = HTTP::Tiny->new;
my $content = "This is a test";
my $response = $http->post_multipart( 'http://localhost:3000/', {
file => {
filename => 'test.txt',
content => $content,
content_type => 'text/plain',
},
testfield => 'test'
} );
creates this:
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"
Content-Type: text/plain
This is a test
--go7DX
Content-Disposition: form-data; name="testfield"
test
--go7DX--
see how the content_type shows up as its own header inside the part, and testfield just rides along as a regular field? iconic behaviour. the way that multipart bodies just work ππ
π CONTRIBUTORS π
these are the people who helped make it happen, show them some love fr fr:
- Stephen Thirlwall
- Markvy
- Infinoid
- Mohammad S Anwar
π AUTHOR π
Renee Baecker <reneeb@cpan.org> β main character energy, honestly.
π COPYRIGHT AND LICENSE π
This software is Copyright (c) 2018 by Renee Baecker.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
bestie, it's free software β read the license, it's right there, don't be weird about it π
and that's the whole page!! this was perl v5.36.0, dated 2022-12-04, and it lives under HTTP::...ltipart(3pm) in the User Contributed Perl Documentation. go forth and multipart your little heart out π§β¨πΈ
π¦ where this page comes from
- debian bookworm: libhttp-tiny-multipart-perl 0.08-2 Β· Artistic-2.0
- debian trixie: libhttp-tiny-multipart-perl 0.08-2 Β· Artistic-2.0
- ubuntu noble: libhttp-tiny-multipart-perl 0.08-2 Β· Artistic-2.0
- ubuntu resolute: libhttp-tiny-multipart-perl 0.08-2 Β· Artistic-2.0
- ubuntu stonking: libhttp-tiny-multipart-perl 0.08-2 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms