Skip to content

Conversation

Phillip9587
Copy link
Contributor

Move options object creation outside the returned parser middlewares to avoid recreating objects on every request.

Move options object creation outside the returned parser middlewares to avoid recreating objects on every request.
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a performance optimization by moving options object creation outside the returned parser middleware functions to avoid recreating objects on every request.

  • Extracts readOptions object creation from inside the middleware functions to the outer scope
  • Updates variable declarations from var to const for consistency
  • Applies the optimization consistently across all four parser types (json, urlencoded, text, raw)

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
lib/types/json.js Moves readOptions object creation outside jsonParser middleware and updates var to const
lib/types/urlencoded.js Moves readOptions object creation outside urlencodedParser middleware and updates var to const
lib/types/text.js Updates variable declaration from var to const (no readOptions extraction needed)
lib/types/raw.js Moves readOptions object creation outside rawParser middleware and updates var to const

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant