@tsed/ts-doc
Version:
Generate documentation in markdown for TypeScript API
62 lines (61 loc) • 1.56 kB
Plain Text
import { JsonHeader, JsonHeaders } from "@tsed/schema";
import { IResponseHeader, IResponseHeaders } from "../../interfaces";
export declare type IHeaderOptions = string | number | IResponseHeader;
export interface IHeadersOptions {
[key: string]: IHeaderOptions;
}
/**
* @ignore
*/
export declare function mapHeaders(headers: IHeadersOptions): IResponseHeaders;
/**
* Sets the response’s HTTP header field to value. To set multiple fields at once, pass an object as the parameter.
*
* ```typescript
* @Header('Content-Type', 'text/plain');
* private myMethod() {}
*
* @Status(204)
* @Header({
* "Content-Type": "text/plain",
* "Content-Length": 123,
* "ETag": {
* "value": "12345",
* "description": "header description"
* }
* })
* private myMethod() {}
* ```
*
* This example will produce the swagger responses object:
*
* ```json
* {
* "responses": {
* "204": {
* "description": "Description",
* "headers": {
* "Content-Type": {
* "type": "string"
* },
* "Content-Length": {
* "type": "number"
* },
* "ETag": {
* "type": "string",
* "description": "header description"
* }
* }
* }
* }
* }
* ```
*
* @returns {Function}
* @decorator
* @endpoint
* @param headers
* @param value
* @deprecated Use @Returns(200).Header("header", "value")
*/
export declare function Header(headers: string | number | JsonHeaders, value?: string | number | JsonHeader): Function;