1HTTP::Tiny::Multipart(3U)ser Contributed Perl DocumentatiHoTnTP::Tiny::Multipart(3)
2
3
4

NAME

6       HTTP::Tiny::Multipart - Add post_multipart to HTTP::Tiny
7

VERSION

9       version 0.08
10

SYNOPSIS

12           use HTTP::Tiny;
13           use HTTP::Tiny::Multipart;
14
15           my $http = HTTP::Tiny->new;
16
17           my $content = "This is a test";
18
19           my $response = $http->post_multipart( 'http://localhost:3000/', {
20               file => {
21                   filename => 'test.txt',
22                   content  => $content,
23               }
24           } );
25
26       creates this request
27
28         POST / HTTP/1.1
29         Content-Length: 104
30         User-Agent: HTTP-Tiny/0.025
31         Content-Type: multipart/form-data; boundary=go7DX
32         Connection: close
33         Host: localhost:3000
34
35         --go7DX
36         Content-Disposition: form-data; name="file"; filename="test.txt"
37
38         This is a test
39         --go7DX--
40
41       And
42
43           use HTTP::Tiny;
44           use HTTP::Tiny::Multipart;
45
46           my $http = HTTP::Tiny->new;
47
48           my $content = "This is a test";
49
50           my $response = $http->post_multipart( 'http://localhost:3000/', {
51               file => {
52                   filename => 'test.txt',
53                   content  => $content,
54                   content_type  => 'text/plain',
55               },
56               testfield => 'test'
57           } );
58
59       creates
60
61         POST / HTTP/1.1
62         Content-Length: 104
63         User-Agent: HTTP-Tiny/0.025
64         Content-Type: multipart/form-data; boundary=go7DX
65         Connection: close
66         Host: localhost:3000
67
68         --go7DX
69         Content-Disposition: form-data; name="file"; filename="test.txt"
70         Content-Type: text/plain
71
72         This is a test
73         --go7DX
74         Content-Disposition: form-data; name="testfield"
75
76         test
77         --go7DX--
78

CONTRIBUTORS

80       •   Stephen Thirlwall
81
82       •   Markvy
83
84       •   Infinoid
85
86       •   Mohammad S Anwar
87

AUTHOR

89       Renee Baecker <reneeb@cpan.org>
90
92       This software is Copyright (c) 2018 by Renee Baecker.
93
94       This is free software, licensed under:
95
96         The Artistic License 2.0 (GPL Compatible)
97
98
99
100perl v5.34.0                      2021-07-22          HTTP::Tiny::Multipart(3)
Impressum