Ensure no params are getting lowercased
This commit is contained in:
parent
31d680d194
commit
5c62fa0a14
2 changed files with 51 additions and 42 deletions
|
@ -110,7 +110,7 @@ type PartialNullable<T> = {
|
|||
type RouteConfig<Args extends object> = {
|
||||
patterns: Array<URLMatcher>;
|
||||
schema: z.ZodType<Args>;
|
||||
parse(result: URLPatternResult): PartialNullable<Args>;
|
||||
parse(result: URLPatternResult, url: URL): PartialNullable<Args>;
|
||||
toWebUrl?(args: Args): URL;
|
||||
toAppUrl?(args: Args): URL;
|
||||
};
|
||||
|
@ -154,7 +154,7 @@ function _route<Key extends string, Args extends object>(
|
|||
if (result) {
|
||||
return {
|
||||
key,
|
||||
args: config.schema.parse(config.parse(result)),
|
||||
args: config.schema.parse(config.parse(result, url)),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -330,9 +330,9 @@ export const captchaRoute = _route('captcha', {
|
|||
schema: z.object({
|
||||
captchaId: paramSchema, // opaque
|
||||
}),
|
||||
parse(result) {
|
||||
parse(_result, url) {
|
||||
return {
|
||||
captchaId: result.hostname.groups.captchaId,
|
||||
captchaId: url.hostname,
|
||||
};
|
||||
},
|
||||
toAppUrl(args) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue