Skip to content

CORS headers for swagger endpoint #14

@VonLatvala

Description

@VonLatvala

In https://github.com/aaronpowell/azure-functions-nodejs-openapi/blob/main/src/openAPIv3.ts#L29 (generateOpenApiSpec), the whole context.res is getting overwritten with an object containing only the response body. This makes it impossible to prepare custom response headers (for example CORS) by wrapping the function in another higher level function.

I propose that generateOpenApiSpec surgically inserts the response body instead of nuking the whole response object.

Another solution could be to accept an option which sets CORS headers as requested, but this is less flexible.

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