Files: ca90b5ca0579ebdcc0635288bce4978e3fb200f5 / test / test-79-npm / cors / cors.js
404 bytesRaw
1 | ; |
2 | |
3 | var cors = require('cors'); |
4 | var req = { method: 'OPTIONS', headers: { } }; |
5 | var res = { headers: {}, getHeader: function (name) { |
6 | return this.headers[name]; |
7 | }, setHeader: function (name, value) { |
8 | this.headers[name] = value; |
9 | }, end: function () { |
10 | if (res.headers['Access-Control-Allow-Origin'] === '*') { |
11 | console.log('ok'); |
12 | } |
13 | } }; |
14 | |
15 | var middleware = cors(); |
16 | middleware(req, res); |
17 |
Built with git-ssb-web