Merge pull request #66 from calcom/fix/docs-url

pull/9078/head
Agusti Fernandez Pardo 2022-05-02 17:50:00 +02:00 committed by GitHub
commit be2d4338ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -8,6 +8,7 @@
"private": true,
"scripts": {
"dev": "next build && PORT=3002 next start",
"dev-real":"PORT=3002 next dev",
"start": "PORT=3002 next start",
"build": "next build",
"lint": "next lint",

View File

@ -29,7 +29,16 @@ const swaggerHandler = withSwagger({
});
export default use(
modifyRes((content: string, _req: NextApiRequest, _res: NextApiResponse) => {
modifyRes((content: string, _req: NextApiRequest, res: NextApiResponse) => {
// Add all headers here instead of next.config.js as it is throwing error( Cannot set headers after they are sent to the client) for OPTIONS method
// It is known to happen only in Dev Mode.
res.setHeader("Access-Control-Allow-Credentials", "true");
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Methods", "GET, OPTIONS, PATCH, DELETE, POST, PUT");
res.setHeader(
"Access-Control-Allow-Headers",
"X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, Content-Type, api_key, Authorization"
);
if (content) {
const parsed = JSON.parse(content);
delete parsed.channels;