Skip to content

Commit

Permalink
chore: replace methods dependency with standard library (#6196)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkoops authored Jan 2, 2025
1 parent 43020ff commit b11122b
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 6 deletions.
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

0 comments on commit b11122b

Please sign in to comment.