Gitter migration: Setup redirects (rollout pt. 3)
[gitter.git] / server / web / middlewares / disallow-transfer-encoding-chunked.js
blob327d4fb2ab949aa911f6c2bb6c18e8b473f2e267
1 'use strict';
3 const StatusError = require('statuserror');
5 // For more context, see https://gitlab.com/gitterHQ/webapp/issues/2291#filtering-out-requests-with-transfer-encoding-chunked-and-content-length
6 module.exports = function(req, res, next) {
7 if (req.headers['transfer-encoding'] === 'chunked') {
8 return next(
9 new StatusError(
10 406,
11 'Using the `Transfer-Encoding: chunked` header is not allowed when interacting with the API'
16 next();