app.pl does not support OPTIONS verb #523

Closed
MarkHofstetter opened this Issue Jan 12, 2014 · 2 comments

3 participants

@MarkHofstetter

package testopt;
use Dancer2;

our $VERSION = '0.1';

options '/test' => sub {
"test\n";
};

true;

then run bin/app.pl

curl -v -H "Accept: application/json" -X OPTIONS 127.0.0.1:3000/test
...
< HTTP/1.0 400 Bad request

Your browser sent a request which this web server could not grok.

...

running the same lib with
plackup --port 3000 bin/app.pl
everthing works

@shumphrey

Dancer2 uses HTTP::Server::Simple::PSGI when run via bin/app.pl, it's that (HTTP::Server::Simple) that doesn't support OPTIONS
plackup uses HTTP::Server::PSGI by default which does.
This isn't really a Dancer2 issue.

@veryrusty
PerlDancer member

The HTTP::Server::Simple docs are fairly clear about how to extend the allowed methods.

Since Dancer2::Core::Server::Standalone is a subclass of HTTP::Server::Simple, its reasonable that it provides its own valid_http_method to allow OPTIONS, which aligns the DSL request methods to what the server classes support. I'll put a Pr together for this soon.

@racke racke closed this in #535 Mar 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment