Skip to content

Validation error when setting up response COARS headers #2

@mahantaf

Description

@mahantaf

There is problem when setting up COARS headers in a middleware before routes middleware:

app.use(function (req, res, next) {
	res.header('Access-Control-Allow-Origin', '*');
	res.header('Access-Control-Allow-Methods', 'GET, PUT, POST, DELETE, OPTIONS');
	res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-Length, X-Requested-With, ACCEPT');
	res.header('Access-Control-Allow-Credentials', true);

	//intercepts OPTIONS method
	if ('OPTIONS' === req.method) {
		//respond with 200
		res.sendStatus(200);
	}
	else {
		//move on
		next();
	}
});

require('./routes')(app);

chapar.RPCServer(
	app,
	config.get("connections.chapar")
);

When using Chapar it returns response validation error.
Please consider this and fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions