Merge pull request #33361 from overleaf/copilot/remove-direct-use-of-body-parser

Remove direct use of body-parser in favour of express built-ins

GitOrigin-RevId: 656c5f216daf68e86d53ae07d272e080bd5ab27f
This commit is contained in:
Lucie Germain
2026-09-17 11:14:46 +00:00
committed by Copybot
parent 6be5db7667
commit 210ced0d31
25 changed files with 24 additions and 65 deletions
@@ -1,4 +1,4 @@
import bodyParser from 'body-parser'
import express from 'express'
import HttpErrorHandler from '../Features/Errors/HttpErrorHandler.mjs'
function isBodyParserError(nextArg) {
@@ -13,7 +13,7 @@ function isBodyParserError(nextArg) {
}
const wrapBodyParser = method => opts => {
const middleware = bodyParser[method](opts)
const middleware = express[method](opts)
return function bodyParser(req, res, next) {
middleware(req, res, nextArg => {
if (isBodyParserError(nextArg)) {
-1
View File
@@ -114,7 +114,6 @@
"base-x": "^4.0.1",
"basic-auth": "^2.0.1",
"bcrypt": "^6.0.0",
"body-parser": "1.20.4",
"bowser": "^2.11.0",
"bull": "^3.18.0",
"bunyan": "^1.8.15",
@@ -1,6 +1,5 @@
import OError from '@overleaf/o-error'
import express from 'express'
import bodyParser from 'body-parser'
/**
* Abstract class for running a mock API via Express. Handles setting up of
@@ -49,8 +48,8 @@ class AbstractMockApi {
this.debug = debug
this.port = port
this.app = express()
this.app.use(bodyParser.json())
this.app.use(bodyParser.urlencoded({ extended: true }))
this.app.use(express.json())
this.app.use(express.urlencoded({ extended: true }))
}
/**