@microsoft/ccf-app

    Interface Response<T>

    The response object returned from an endpoint function.

    Example returning JSON:

    return {
    body: {
    foo: "bar"
    }
    };

    Example returning plaintext and custom headers and status code:

    return {
    statusCode: 404,
    headers: {
    "x-request-id": "123"
    },
    body: "nobody's home"
    };

    See the property descriptions below for further details on allowed data types, default headers, and default status codes.

    interface Response<T extends ResponseBodyType<T> = any> {
        body?: T;
        headers?: { [key: string]: string };
        statusCode?: number;
    }

    Type Parameters

    Index

    Properties

    body?: T

    The body of the response.

    Either

    The content type in parentheses is the default and can be overridden in headers.

    headers?: { [key: string]: string }

    An object mapping lower-case HTTP header names to their values. The type of body determines the default value of the content-type header.

    statusCode?: number

    The HTTP status code to return. Defaults to 200, or 500 if an exception is raised.

    MMNEPVFCICPMFPCPTTAAATR