alagarr
Version:
Alagarr is a request-response helper library that removes the boilerplate from your Node.js serverless functions and helps make your code portable.
21 lines (20 loc) • 1.06 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const requests_1 = require("../../../test/fixtures/requests");
const normalize_headers_1 = __importDefault(require("./normalize-headers"));
const testRequest = Object.assign({}, requests_1.get, { body: 'foobar', headers: { 'X-Foo-Bar': 'foobar' } });
describe('Normalize request headers', () => {
test('headers to lower-case', () => {
const expected = Object.assign({}, testRequest, { headers: { 'x-foo-bar': 'foobar' } });
const normalized = normalize_headers_1.default(testRequest);
expect(normalized).toEqual(expected);
});
test('headers can be empty', () => {
const expected = Object.assign({}, testRequest, { headers: {} });
const normalized = normalize_headers_1.default(Object.assign({}, testRequest, { headers: undefined }));
expect(normalized).toEqual(expected);
});
});