swagger-express-ts icon indicating copy to clipboard operation
swagger-express-ts copied to clipboard

Headers

Open Ankit1995-appinventiv opened this issue 4 years ago • 1 comments

How can i accept headers like device token.

Ankit1995-appinventiv avatar May 08 '20 11:05 Ankit1995-appinventiv

With swagger-express-ts:v1.1.0 you can now specify headers params

  @ApiOperationGet({
        path: `/mypath/{name}`,
        summary: 'Execute a custom view',
        parameters: {
            header: {
                'x-device-token': {
                    description: 'The device token',
                    type: SwaggerDefinitionConstant.Parameter.Type.STRING,
                    required: true,
                },
            },
            path: {
                name: {
                    description: 'The view name',
                    type: SwaggerDefinitionConstant.Parameter.Type.STRING,
                    required: true,
                },
            },
        },
        responses: {
            200: {
                description: 'Success',
                type: SwaggerDefinitionConstant.Response.Type.OBJECT,
            }
        }
    })

thinkingmik avatar Apr 15 '21 07:04 thinkingmik