Replace direct body-parser dependency with Express built-in parser - #5995
Conversation
Replace the external body-parser dependency with Express's built-in parser for one less dependency No functional changes intended
62fc1c7 to
217d9cf
Compare
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin dspace-8_x
git worktree add -d .worktree/backport-5995-to-dspace-8_x origin/dspace-8_x
cd .worktree/backport-5995-to-dspace-8_x
git switch --create backport-5995-to-dspace-8_x
git cherry-pick -x 217d9cf84910ec88c6af24402ee86caff122a0d5 |
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin dspace-9_x
git worktree add -d .worktree/backport-5995-to-dspace-9_x origin/dspace-9_x
cd .worktree/backport-5995-to-dspace-9_x
git switch --create backport-5995-to-dspace-9_x
git cherry-pick -x 217d9cf84910ec88c6af24402ee86caff122a0d5 |
|
Successfully created backport PR for |
|
@MMilosz : It looks like this will need to be manually backported to 9.x and 8.x. The automated backport was only able to port this back to 10.x |
|
I backported this to 9.x in #6121. Also verified it does NOT need backporting to |
| @@ -134,7 +133,7 @@ export function app() { | |||
| * Add JSON parser for request bodies | |||
| * See [body-parser](https://github.com/expressjs/body-parser) | |||
There was a problem hiding this comment.
@MMilosz this comment should be updated (or simply remove the second line?) to avoid confusion. If you can make a quick PR I will merge it ASAP. Thank you!
References
none
Description
Before Express 4.16 (released in 2017), applications needed to add the separate
body-parserdependency. Express now provides built-in body parsing middleware, so there is no need to add the dependency directly, especially since we rely on the default configuration.This PR:
body-parserdependencyNo functional changes intended
Instructions for Reviewers
List of changes in this PR:
package.json: removed the directbody-parserdependencyserver.ts: usesserver.use(express.json())instead ofserver.use(json())Before:
After:
(Note that
--depth=0checks direct dependencies only.body-parserwill still appear as a transitive dependency of other packages e.g. Express, Karma)To review:
Checklist
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.