bin/server/response.js
function Response(request, key) {

    // define private store
    const store = {
        body: '',
        cookies: [],
        headers: {},
        key: key,
        sent: false,
        statusCode: 0
    };
    this[STORE] = store;


    /**
     * The request that is tied to this response.
     * @name Response#req
     * @type {Request}
     */
    Object.defineProperty(this, 'req', {
        configurable: false,
        enumerable: true,
        value: request
    });

    /**
     * Determine if the response has already been sent.
     * @name Response#sent
     * @type {boolean}
     */
    Object.defineProperty(this, 'sent', {
        enumerable: true,
        get: () => store.sent
    });

    /**
     * Get the server instance that initialized this response.
     * @name Request#server
     * @type {SansServer}
     */
    Object.defineProperty(this, 'server', {
        enumerable: true,
        configurable: false,
        value: request.server
    });

    /**
     * Get a copy of the current response state.
     * @name Response#state
     * @type {ResponseState}
     */
    Object.defineProperty(this, 'state', {
        configurable: false,
        enumerable: true,
        get: () => {
            return {
                body: store.body,
                cookies: store.cookies.concat(),
                headers: Object.assign({}, store.headers),
                rawHeaders: rawHeaders(store.headers, store.cookies),
                statusCode: store.statusCode
            }
        }
    });

    /**
     * Get or set the status code.
     * @name Response#statusCode
     * @type {number}
     */
    Object.defineProperty(this, 'statusCode', {
        configurable: false,
        enumerable: true,
        get: () => store.statusCode,
        set: v => this.status(v)
    });

    /**
     * Produce a log event.
     * @param {string} message
     * @param {...*} [arg]
     * @returns {Response}
     * @fires Response#log
     */
    this.log = request.logger('sans-server', 'response', this);
}
function Response(request, key) {

    // define private store
    const store = {
        body: '',
        cookies: [],
        headers: {},
        key: key,
        sent: false,
        statusCode: 0
    };
    this[STORE] = store;


    /**
     * The request that is tied to this response.
     * @name Response#req
     * @type {Request}
     */
    Object.defineProperty(this, 'req', {
        configurable: false,
        enumerable: true,
        value: request
    });

    /**
     * Determine if the response has already been sent.
     * @name Response#sent
     * @type {boolean}
     */
    Object.defineProperty(this, 'sent', {
        enumerable: true,
        get: () => store.sent
    });

    /**
     * Get the server instance that initialized this response.
     * @name Request#server
     * @type {SansServer}
     */
    Object.defineProperty(this, 'server', {
        enumerable: true,
        configurable: false,
        value: request.server
    });

    /**
     * Get a copy of the current response state.
     * @name Response#state
     * @type {ResponseState}
     */
    Object.defineProperty(this, 'state', {
        configurable: false,
        enumerable: true,
        get: () => {
            return {
                body: store.body,
                cookies: store.cookies.concat(),
                headers: Object.assign({}, store.headers),
                rawHeaders: rawHeaders(store.headers, store.cookies),
                statusCode: store.statusCode
            }
        }
    });

    /**
     * Get or set the status code.
     * @name Response#statusCode
     * @type {number}
     */
    Object.defineProperty(this, 'statusCode', {
        configurable: false,
        enumerable: true,
        get: () => store.statusCode,
        set: v => this.status(v)
    });

    /**
     * Produce a log event.
     * @param {string} message
     * @param {...*} [arg]
     * @returns {Response}
     * @fires Response#log
     */
    this.log = request.logger('sans-server', 'response', this);
}
function Response ( request , key ) { // define private store const store = { body : '' , cookies : [ ] , headers : { } , key : key , sent : false , statusCode : 0 } ; this [ STORE ] = store ; /**
     * The request that is tied to this response.
     * @name Response#req
     * @type {Request}
     */ Object . defineProperty ( this , 'req' , { configurable : false , enumerable : true , value : request } ) ; /**
     * Determine if the response has already been sent.
     * @name Response#sent
     * @type {boolean}
     */ Object . defineProperty ( this , 'sent' , { enumerable : true , get : ( ) => store . sent } ) ; /**
     * Get the server instance that initialized this response.
     * @name Request#server
     * @type {SansServer}
     */ Object . defineProperty ( this , 'server' , { enumerable : true , configurable : false , value : request . server } ) ; /**
     * Get a copy of the current response state.
     * @name Response#state
     * @type {ResponseState}
     */ Object . defineProperty ( this , 'state' , { configurable : false , enumerable : true , get : ( ) => { return { body : store . body , cookies : store . cookies . concat ( ) , headers : Object . assign ( { } , store . headers ) , rawHeaders : rawHeaders ( store . headers , store . cookies ) , statusCode : store . statusCode } } } ) ; /**
     * Get or set the status code.
     * @name Response#statusCode
     * @type {number}
     */ Object . defineProperty ( this , 'statusCode' , { configurable : false , enumerable : true , get : ( ) => store . statusCode , set : v => this . status ( v ) } ) ; /**
     * Produce a log event.
     * @param {string} message
     * @param {...*} [arg]
     * @returns {Response}
     * @fires Response#log
     */ this . log = request . logger ( 'sans-server' , 'response' , this ) ; }
Create a response instance.
@param {Request} request The request that is relying on this response that is being created.
@param {Symbol} key
@returns {Response}
@constructor
Create a response instance .