add HTTP status enums, rework ErrorReponse proxy to use them
[squeep-api-dingus] / lib / patches / incoming-message.js
1 'use strict';
2 const { IncomingMessage } = require('http');
3
4 /**
5 * Welp, here we are, already into the crazy.
6 * This originally existed due to a misinterpretation of the documentation,
7 * but it's really quite useful, so it stays in our world.
8 */
9 /* istanbul ignore else */
10 if (typeof IncomingMessage.getHeader !== 'function') {
11 IncomingMessage.prototype.getHeader = function (name) {
12 if (typeof name !== 'string') {
13 throw new TypeError('\'name\' must be a string');
14 }
15 return this.headers && this.headers[name.toLowerCase()];
16 };
17 }