Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP 'options' requests #16

Open
codeuniquely opened this issue Jan 31, 2015 · 1 comment
Open

HTTP 'options' requests #16

codeuniquely opened this issue Jan 31, 2015 · 1 comment

Comments

@codeuniquely
Copy link

Would it be possible to add routing for OPTIONS

POST, GET, PUT, PATCH, DELETE and ANY already exist but the ability to deal with a "pre-flight" OPTIONS request explicitly, would be very useful, like this maybe:

route.options('*', function(req,res) {
  var headers = {};
  headers["Access-Control-Allow-Origin"] = "*";
  headers["Access-Control-Allow-Methods"] = "POST, GET, PUT, DELETE, OPTIONS";
  headers["Access-Control-Allow-Credentials"] = true;
  headers["Access-Control-Max-Age"] = '86400'; // 24 hours
  headers["Access-Control-Allow-Headers"] = "X-Requested-With, Access-Control-Allow-Origin, X-HTTP-Method-Override, Content-Type, Authorization, Accept";

  // respond to the request
  res.writeHead(200, headers);
  res.end();
});
@finwo
Copy link

finwo commented Jun 7, 2017

@codeuniquely Support for the OPTIONS method has been written in #29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants