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
req.params implicitly decodes each part of the path into a corresponding path variable.
If one of the path variables is used as a slug, then that slug would need to be stored decoded in the database in order to be looked up. Storing a slug as a decoded path means the slug is no longer a valid part of a URL. If the slug is used for embedded URLs this means it will have to be encoded every time.
Since a slug is part of URL, believe it is a reasonable expectation of consumers of the library to store slugs in a valid encoded form.
To my knowledge, because const { params } = req; implicitly decodes each value in the object, it is currently impossible to look up an encoded slug.
Thoughts/ideas/gotchas?
The text was updated successfully, but these errors were encountered:
Module currently uses decoded path variables via req params:
https://github.com/Econify/graphql-rest-router/blob/master/Route.ts#L290
req.params
implicitly decodes each part of the path into a corresponding path variable.If one of the path variables is used as a slug, then that slug would need to be stored decoded in the database in order to be looked up. Storing a slug as a decoded path means the slug is no longer a valid part of a URL. If the slug is used for embedded URLs this means it will have to be encoded every time.
Since a slug is part of URL, believe it is a reasonable expectation of consumers of the library to store slugs in a valid encoded form.
To my knowledge, because
const { params } = req;
implicitly decodes each value in the object, it is currently impossible to look up an encoded slug.Thoughts/ideas/gotchas?
The text was updated successfully, but these errors were encountered: