Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace methods dependency with standard library #6196

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ unreleased
* cleanup: remove AsyncLocalStorage check from tests
* cleanup: remove unnecessary require for global Buffer
* perf: use loop for acceptParams
* Replace `methods` dependency with standard library

5.0.1 / 2024-10-08
==========
Expand Down
2 changes: 1 addition & 1 deletion lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
*/

var finalhandler = require('finalhandler');
var methods = require('methods');
var debug = require('debug')('express:application');
var View = require('./view');
var http = require('http');
var methods = require('./utils').methods;
var compileETag = require('./utils').compileETag;
var compileQueryParser = require('./utils').compileQueryParser;
var compileTrust = require('./utils').compileTrust;
Expand Down
7 changes: 7 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@
* @api private
*/

var { METHODS } = require('node:http');
var contentType = require('content-type');
var etag = require('etag');
var mime = require('mime-types')
var proxyaddr = require('proxy-addr');
var qs = require('qs');
var querystring = require('querystring');

/**
* A list of lowercased HTTP methods that are supported by Node.js.
* @api private
*/
exports.methods = METHODS.map((method) => method.toLowerCase());

/**
* Return strong ETag for `body`.
*
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"fresh": "2.0.0",
"http-errors": "2.0.0",
"merge-descriptors": "^2.0.0",
"methods": "~1.1.2",
"mime-types": "^3.0.0",
"on-finished": "2.4.1",
"once": "1.4.0",
Expand Down
2 changes: 1 addition & 1 deletion test/Route.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var after = require('after');
var assert = require('assert')
var express = require('../')
, Route = express.Route
, methods = require('methods')
, methods = require('../lib/utils').methods

describe('Route', function(){
it('should work without handlers', function(done) {
Expand Down
2 changes: 1 addition & 1 deletion test/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var after = require('after');
var express = require('../')
, Router = express.Router
, methods = require('methods')
, methods = require('../lib/utils').methods
, assert = require('assert');

describe('Router', function(){
Expand Down
2 changes: 1 addition & 1 deletion test/app.router.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var after = require('after');
var express = require('../')
, request = require('supertest')
, assert = require('assert')
, methods = require('methods');
, methods = require('../lib/utils').methods;

var shouldSkipQuery = require('./support/utils').shouldSkipQuery

Expand Down
2 changes: 1 addition & 1 deletion test/res.send.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var assert = require('assert')
var express = require('..');
var methods = require('methods');
var methods = require('../lib/utils').methods;
var request = require('supertest');
var utils = require('./support/utils');

Expand Down
Loading