all files / modules/extensions/ acceptCharset.js

88.89% Statements 8/9
50% Branches 1/2
66.67% Functions 2/3
88.89% Lines 8/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 AcceptCharset = require("../headers/AcceptCharset");
 
module.exports = function (mach) {
    Object.defineProperties(mach.Connection.prototype, {
 
    /**
     * Returns true if the request indicates that the client accepts
     * the given character set.
     */
        acceptsCharset: d(function (charset) {
            return this.request.acceptsCharset(charset);
        })
 
    });
 
    Object.defineProperties(mach.Message.prototype, {
 
    /**
     * Returns true if the client accepts the given character set.
     */
        acceptsCharset: d(function (charset) {
            Eif (!this._acceptCharsetHeader) {
                this._acceptCharsetHeader = new AcceptCharset(this.headers["Accept-Charset"]);
            }
 
            return this._acceptCharsetHeader.accepts(charset);
        })
 
    });
};