You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varroute=/\/foo\/(bar)?/;// In modern browsers:console.log(route.exec('/foo/'));// => ["/foo/", undefined]// In IE < 9:console.log(route.exec('/foo/'));// => ["/foo/", ""]
In the context of route dispatching in Router, the result of exec()-ing the regex route path is assigned to req.params. Since request parameters are dealing with strings, I think a fine compromise is to always make sure they are an array of strings and coerce undefined to empty string, both are falsy values.
The text was updated successfully, but these errors were encountered:
We recently fixed issue #964 to support Non Participating Capture Groups (NPCG) in regex Router paths. But the tests for this change were not run in IE < 9, and when they are subtle differences are surfaced in how old IEs vs. modern browsers deal with NPCG when calling the regex's
exec()
method. The following example illustrates the issue:In the context of route dispatching in Router, the result of
exec()
-ing the regex route path is assigned toreq.params
. Since request parameters are dealing with strings, I think a fine compromise is to always make sure they are an array of strings and coerceundefined
to empty string, both are falsy values.The text was updated successfully, but these errors were encountered: