From e9ff7d9c4aff3f7e5bb8aaf28180b2a41aaa4ede Mon Sep 17 00:00:00 2001 From: Douglas Christopher Wilson Date: Mon, 13 Dec 2021 01:21:03 -0500 Subject: [PATCH] Drop support for Node.js 0.8 --- .github/workflows/ci.yml | 16 ---------------- HISTORY.md | 1 + index.js | 18 ++---------------- package.json | 2 +- 4 files changed, 4 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f80ad3..12a1296 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,6 @@ jobs: strategy: matrix: name: - - Node.js 0.8 - Node.js 0.10 - Node.js 0.12 - io.js 1.x @@ -28,11 +27,6 @@ jobs: - Node.js 13.x include: - - name: Node.js 0.8 - node-version: "0.8" - npm-i: mocha@2.5.3 supertest@1.1.0 - npm-rm: nyc - - name: Node.js 0.10 node-version: "0.10" npm-i: mocha@3.5.3 nyc@10.3.2 supertest@2.0.0 @@ -110,21 +104,11 @@ jobs: shell: bash -eo pipefail -l {0} run: | nvm install --default ${{ matrix.node-version }} - if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then - nvm install --alias=npm 0.10 - nvm use ${{ matrix.node-version }} - sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")" - npm config set strict-ssl false - fi dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH" - name: Configure npm run: npm config set shrinkwrap false - - name: Remove npm module(s) ${{ matrix.npm-rm }} - run: npm rm --silent --save-dev ${{ matrix.npm-rm }} - if: matrix.npm-rm != '' - - name: Install npm module(s) ${{ matrix.npm-i }} run: npm install --save-dev ${{ matrix.npm-i }} if: matrix.npm-i != '' diff --git a/HISTORY.md b/HISTORY.md index 1d9a5f3..66d3ced 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,6 +1,7 @@ 1.x === + * Drop support for Node.js 0.8 * Remove `from` alias to `root` -- use `root` directly * Remove `send.etag()` -- use `etag` in `options` * Remove `send.index()` -- use `index` in `options` diff --git a/index.js b/index.js index 71625f2..74bceb1 100644 --- a/index.js +++ b/index.js @@ -539,7 +539,7 @@ SendStream.prototype.send = function send (path, stat) { var ranges = req.headers.range var offset = options.start || 0 - if (headersSent(res)) { + if (res.headersSent) { // impossible to send now this.headersAlreadySent() return @@ -936,7 +936,7 @@ function getHeaderNames (res) { /** * Determine if emitter has listeners of a given type. * - * The way to do this check is done three different ways in Node.js >= 0.8 + * The way to do this check is done three different ways in Node.js >= 0.10 * so this consolidates them into a minimal set using instance methods. * * @param {EventEmitter} emitter @@ -953,20 +953,6 @@ function hasListeners (emitter, type) { return count > 0 } -/** - * Determine if the response headers have been sent. - * - * @param {object} res - * @returns {boolean} - * @private - */ - -function headersSent (res) { - return typeof res.headersSent !== 'boolean' - ? Boolean(res._header) - : res.headersSent -} - /** * Normalize the index option into an array. * diff --git a/package.json b/package.json index f58140c..2bbce46 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "index.js" ], "engines": { - "node": ">= 0.8.0" + "node": ">= 0.10" }, "scripts": { "lint": "eslint .",