## [Unreleased]
+- updated dependencies and devDependencies
+
## [v2.1.2] - 2024-06-08
- addCookie helper does more validation
/**
* @typedef {import('node:http')} http
+ * @typedef {import('node:fs')} fs
*/
/**
* Simple ETag from data.
* @param {string} _filePath (currently unused)
- * @param {object} fileStat node:fs.Stats object
+ * @param {fs.Stats} fileStat node:fs.Stats object
* @param {number} fileStat.mtimeMs node:fs.Stats object
* @param {crypto.BinaryLike} fileData content
* @returns {string} etag
const common = require('../../lib/common');
-describe('common', function () {
+describe('Common', function () {
describe('generateETag', function () {
it('generates a tag from data', function () {
});
}); // addCookie
-});
+}); // Common
const assert = require('node:assert');
const sinon = require('sinon');
-const fs = require('fs');
+const fs = require('node:fs');
const Dingus = require('../../lib/dingus');
const { DingusError, RouterNoMethodError } = require('../../lib/errors');
};
ctx = {};
});
- it ('covers untrusted proxy', function () {
+ it('covers untrusted proxy', function () {
dingus.trustProxy = false;
const expected = {
clientAddress: '',
assert.deepStrictEqual(ctx, expected);
assert(!req.getHeader.called);
});
- it ('covers missing', function () {
+ it('covers missing', function () {
dingus.trustProxy = true;
const expected = {
clientAddress: '::1',
assert(dingus.serveFile.called);
});
}); // handlerGetStaticFile
-});
+}); // Dingus
});
}); // ErrorResponse
-});
+}); // Enum
const assert = require('node:assert');
const MimeHelper = require('../../lib/mime-helper');
-describe('ext-to-mime', function () {
+describe('MimeHelper', function () {
describe('extensionToMime', function () {
it('returns default for unknown extension', function () {
});
}); // extensionToMime
-});
+}); // MimeHelper
const { IncomingMessage } = require('node:http');
require('../../../lib/patches/incoming-message');
-describe('IncomingMessage.getHeader', function () {
+describe('Patch IncomingMessage.getHeader', function () {
let im;
beforeEach(function () {
im = new IncomingMessage();
const result = im.getHeader(name);
assert.strictEqual(result, value);
});
-});
+}); // Patch IncomingMessage.getHeader
}); // lookup
-});
+}); // Router
-/* eslint-env mocha */
'use strict';
const assert = require('node:assert');