How to use the @hapi/accept.encoding function in @hapi/accept

To help you get started, we’ve selected a few @hapi/accept examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hapijs / hapi / lib / compression.js View on Github external
internals.common.forEach((header) => {

            this._common.set(header, Accept.encoding(header, this.encodings));
        });
    }
github hapijs / hapi / lib / compression.js View on Github external
accept(request) {

        const header = request.headers['accept-encoding'];
        if (!header) {
            return 'identity';
        }

        const common = this._common.get(header);
        if (common) {
            return common;
        }

        try {
            return Accept.encoding(header, this.encodings);
        }
        catch (err) {
            Bounce.rethrow(err, 'system');
            err.header = header;
            request._log(['accept-encoding', 'error'], err);
            return 'identity';
        }
    }

@hapi/accept

HTTP Accept-* headers parsing

BSD-3-Clause
Latest version published 7 months ago

Package Health Score

81 / 100
Full package analysis