-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
Express 5 req.query immutable #969
Comments
+1. I've implemented an ugly workaround for it by making query mutable: app.use((req, res, next) => {
if (req.query)
Object.defineProperty(req, 'query', {
writable: true,
value: { ...req.query },
})
next()
}) |
+1 I am facing the same problem. I have remarked that req.query does not inherit from Object.prototype anymore ([Object: null prototype]), I dunno whether or not it can be useful to fix this problem. Is it planned to fix this bug...? Thank you ! |
thanks all. i've started a new branch express-5-support to tackle support for express 5. seeking community to help resolve the remaining issues |
Hello With #1036 the number goes down to 15, due to a fix I've made in some tests. With the routing syntax changes, I don't think there's an easy way to have tests that guarantee both express 4 and express 5 compatibility, but we can think of that after all the tests route have its matching syntax fixed. Right now, I still haven't found a way to have the same wildcard tests for express 5 |
The request parameter mutator is broken when express 5 is used
When you have a query parameter definition for array values, the req.query[key] could not be updated because it is immutable in express 5.
The req.query key values are not parsed by its query parameter definitions in the OpenApi 3 specs
The req.query parameters should be parsed like defined in the OpenApi 3 schema for the query parameter
Example sort query parameter definition:
name: sort
in: query
description: Sort parameter
required: false
style: pipeDelimited
explode: false
schema:
type: array
items:
type: string
req.query = { sort: "name|date"} should be having an array value after parsing: req.query = { sort: ["name", "date"]}, but it remains the same value req.query = { sort: "name|date"}
The text was updated successfully, but these errors were encountered: