Created
April 8, 2013 18:07
-
-
Save xaicron/5339021 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use feature 'say'; | |
BEGIN { | |
my @methods = (); | |
push @methods, qw{ GET POST PUT DELETE }; # HTTP/1.0 | |
push @methods, qw{ OPTIONS TRACE CONNECT }; # HTTP/1.1 | |
push @methods, qw{ | |
PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK | |
}; # WebDAV | |
push @methods, ( | |
'ACL', # RFC3744 | |
'BASELINE-CONTROL', # RFC3253 | |
'BIND', # RFC5842 | |
'CHECKIN', # RFC3253 | |
'CHECKOUT', # RFC3253 | |
'LABEL', # RFC3253 | |
'LINK', # RFC2068 | |
'MERGE', # RFC3253 | |
'MKACTIVITY', # RFC3253 | |
'MKCALENDAR', # RFC4791 | |
'MKREDIRECTREF', # RFC4437 | |
'MKWORKSPACE', # RFC3253 | |
'ORDERPATCH', # RFC3648 | |
'PATCH', # RFC5789 | |
'REBIND', # RFC5842 | |
'REPORT', # RFC3253 | |
'SEARCH', # RFC5323 | |
'UNBIND', # RFC5842 | |
'UNCHECKOUT', # RFC3253 | |
'UNLINK', # RFC2068 | |
'UPDATE', # RFC3253 | |
'UPDATEREDIRECTREF', # RFC4437 | |
'VERSION-CONTROL', # RFC3253 | |
); | |
for (@methods) { | |
my $method = lc $_; | |
$method =~ tr/-/_/; | |
eval "sub $method { say '$_' }"; | |
eval "sub m_$method { say 'M-$_' }"; # provide mandatory request method | |
} | |
} | |
::get '/' => sub {}; | |
::post '/' => sub {}; | |
::put '/' => sub {}; | |
::delete '/' => sub {}; | |
::patch '/' => sub {}; | |
::options '/' => sub {}; | |
::trace '/' => sub {}; | |
::connect '/' => sub {}; | |
::propfind '/' => sub {}; | |
::proppatch '/' => sub {}; | |
::mkcol '/' => sub {}; | |
::copy '/' => sub {}; | |
::move '/' => sub {}; | |
::lock '/' => sub {}; | |
::unlock '/' => sub {}; | |
::acl '/' => sub {}; | |
::baseline_control '/' => sub {}; | |
::bind '/' => sub {}; | |
::checkin '/' => sub {}; | |
::checkout '/' => sub {}; | |
::label '/' => sub {}; | |
::link '/' => sub {}; | |
::merge '/' => sub {}; | |
::mkactivity '/' => sub {}; | |
::mkcalendar '/' => sub {}; | |
::mkredirectref '/' => sub {}; | |
::mkworkspace '/' => sub {}; | |
::orderpatch '/' => sub {}; | |
::patch '/' => sub {}; | |
::rebind '/' => sub {}; | |
::report '/' => sub {}; | |
::search '/' => sub {}; | |
::unbind '/' => sub {}; | |
::uncheckout '/' => sub {}; | |
::unlink '/' => sub {}; | |
::update '/' => sub {}; | |
::updateredirectref '/' => sub {}; | |
::version_control '/' => sub {}; | |
::m_get '/' => sub {}; | |
::m_post '/' => sub {}; | |
::m_put '/' => sub {}; | |
::m_delete '/' => sub {}; | |
::m_patch '/' => sub {}; | |
::m_options '/' => sub {}; | |
::m_trace '/' => sub {}; | |
::m_connect '/' => sub {}; | |
::m_propfind '/' => sub {}; | |
::m_proppatch '/' => sub {}; | |
::m_mkcol '/' => sub {}; | |
::m_copy '/' => sub {}; | |
::m_move '/' => sub {}; | |
::m_lock '/' => sub {}; | |
::m_unlock '/' => sub {}; | |
::m_acl '/' => sub {}; | |
::m_baseline_control '/' => sub {}; | |
::m_bind '/' => sub {}; | |
::m_checkin '/' => sub {}; | |
::m_checkout '/' => sub {}; | |
::m_label '/' => sub {}; | |
::m_link '/' => sub {}; | |
::m_merge '/' => sub {}; | |
::m_mkactivity '/' => sub {}; | |
::m_mkcalendar '/' => sub {}; | |
::m_mkredirectref '/' => sub {}; | |
::m_mkworkspace '/' => sub {}; | |
::m_orderpatch '/' => sub {}; | |
::m_patch '/' => sub {}; | |
::m_rebind '/' => sub {}; | |
::m_report '/' => sub {}; | |
::m_search '/' => sub {}; | |
::m_unbind '/' => sub {}; | |
::m_uncheckout '/' => sub {}; | |
::m_unlink '/' => sub {}; | |
::m_update '/' => sub {}; | |
::m_updateredirectref '/' => sub {}; | |
::m_version_control '/' => sub {}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment