mirror of https://github.com/pelias/api.git
Peter Johnson
9 years ago
3 changed files with 20 additions and 1 deletions
@ -0,0 +1,18 @@ |
|||||||
|
|
||||||
|
/** |
||||||
|
this functionality is required by CORS as the browser will send an |
||||||
|
HTTP OPTIONS request before performing the CORS request. |
||||||
|
|
||||||
|
if the OPTIONS request returns a non-200 status code then the
|
||||||
|
transaction will fail. |
||||||
|
**/ |
||||||
|
|
||||||
|
function middleware(req, res, next){ |
||||||
|
if( req.method === 'OPTIONS' ){ |
||||||
|
res.send(200); |
||||||
|
} else { |
||||||
|
next(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
module.exports = middleware; |
Loading…
Reference in new issue