-
-
Save FROGGS/d14fb9f9b6cd6f33acb26cc11cf7ffe2 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
$(document).ready(function () { | |
$.ajax({ type: "HEAD", url: '/foobar', dataType: "html", }).done(function (data) { console.log(data) }); // NOK, gives 404 | |
$.ajax({ type: "LINK", url: '/foobar', dataType: "html", }).done(function (data) { console.log(data) }); // OK | |
$.ajax({ type: "UNLINK", url: '/foobar', dataType: "html", }).done(function (data) { console.log(data) }); // OK | |
$.ajax({ type: "FLUBBER", url: '/foobar', dataType: "html", }).done(function (data) { console.log(data) }); // OK | |
$.ajax({ type: "FOOBAR", url: '/foobar', dataType: "html", }).done(function (data) { console.log(data) }); // OK | |
}); |
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
package Foobar; | |
use Mojo::Base 'Mojolicious'; | |
use feature ':5.24'; | |
use experimental qw(signatures refaliasing); | |
no warnings qw(experimental); | |
sub startup($app) { | |
my $r = $app->routes; | |
# neither of these work | |
$r->any(['HEAD'] => '/foobar')->to(cb => sub { warn; shift->render(json => '"HEAD"' ) }); | |
$r->_generate_route(HEAD => '/foobar')->to(cb => sub { warn; shift->render(json => '"HEAD"' ) }); | |
# but these do work | |
$r->any(['LINK'] => '/foobar')->to(cb => sub { warn; shift->render(json => '"LINK"' ) }); | |
$r->any(['UNLINK'] => '/foobar')->to(cb => sub { warn; shift->render(json => '"UNLINK"' ) }); | |
$r->any(['FLUBBER'] => '/foobar')->to(cb => sub { warn; shift->render(json => '"FLUBBER"' ) }); | |
$r->_generate_route(FOOBAR => '/foobar')->to(cb => sub { warn; shift->render(json => '"FOOBAR"' ) }); | |
} | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment