MCPcopy Create free account
hub / github.com/ampproject/amphtml / setCorsHeaders

Function setCorsHeaders

build-system/server/test-server.js:19–25  ·  view source on GitHub ↗

* * @param {express.Request} req * @param {express.Response} res * @param {express.NextFunction} next

(req, res, next)

Source from the content-addressed store, hash-verified

17 * @param {express.NextFunction} next
18 */
19function setCorsHeaders(req, res, next) {
20 res.setHeader('Access-Control-Allow-Credentials', 'true');
21 res.setHeader('Access-Control-Allow-Origin', req.headers.origin || '*');
22 res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
23 res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
24 next();
25}
26app.use(setCorsHeaders);
27
28app.use('/get', function (req, res) {

Callers

nothing calls this directly

Calls 1

nextFunction · 0.50

Tested by

no test coverage detected