all files / modules/extensions/ acceptEncoding.js

100% Statements 9/9
50% Branches 1/2
100% Functions 3/3
100% Lines 9/9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32                                              
const d = require("describe-property");
const AcceptEncoding = require("../headers/AcceptEncoding");
 
module.exports = function (mach) {
    Object.defineProperties(mach.Connection.prototype, {
 
    /**
     * Returns true if the request indicates that the client accepts
     * the given content encoding.
     */
        acceptsEncoding: d(function (encoding) {
            return this.request.acceptsEncoding(encoding);
        })
 
    });
 
    Object.defineProperties(mach.Message.prototype, {
 
    /**
     * Returns true if the client accepts the given content encoding.
     */
        acceptsEncoding: d(function (encoding) {
            Eif (!this._acceptEncodingHeader) {
                this._acceptEncodingHeader = new AcceptEncoding(this.headers["Accept-Encoding"]);
            }
 
            return this._acceptEncodingHeader.accepts(encoding);
        })
 
    });
};