资源说明:Tunnel REST methods to Plack apps via POST
header in a request:
my $req = HTTP::Request->new(POST => '/foo', [
'X-HTTP-Method-Override' => 'PUT'
]);
=head1 Description
Writing
Lful apps
is a good thing, but if you're also trying to support web browsers, it would
be nice not to be reduced to C and C for everything.
This middleware allows for C requests that pretend to be something else:
by adding either a header named C to the request, or
a query parameter named C to the URI, the client can say
what method it actually meant. That is, as long as it meant one of these:
=over
=item * GET
=item * POST
=item * HEAD
=item * PUT
=item * DELETE
=item * OPTIONS
=item * TRACE
=item * CONNECT
=item * PATCH
=back
If so, then the C in the PSGI environment will be replaced
with the client's desired value. The original request method is always stored
under the C key.
=head1 Configuration
These are the named arguments you can pass to C. Or, more likely, on the
C line in your C block, as in
enable 'MethodOverride', header => 'X-HTTP-Method', param => 'my_method';
=head2 C
Specifies the HTTP header name which specifies the overriding HTTP method.
Defaults to C, as used by Google for its APIs.
=head2 C
Specifies the query parameter name to specify the overriding HTTP method.
Defaults to C.
=head1 Acknowledgements
This module gleefully steals from
L by Dave Rolsky and the
original version by Tatsuhiko Miyagawa (which in turn stole from
L). Thanks to L for the shove in this direction, to L for suggesting that it be implemented as
middleware, and to L for
convincing me not to parse body parameters.
=head1 Authors
=over 4
=item *
Tatsuhiko Miyagawa
=item *
David E. Wheeler
=item *
Aristotle Pagaltzis
=back
=head1 Copyright and License
This software is copyright (c) 2015 by Tatsuhiko Miyagawa, David E. Wheeler, Aristotle Pagaltzis.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
=pod =encoding UTF-8 =head1 Name Plack::Middleware::MethodOverride - Override REST methods to Plack apps via POST =head1 Version version 0.20 =begin html =end html =head1 Synopsis In your Plack app: use Plack::Builder; builder { enable MethodOverride; $app; }; PUT via a query parameter in your POST forms:Or override it via the C
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。