Skip to content

Custom QueryString parser support #882

Open
@radixxko

Description

Bug Report

Hey Samchon,

we are having issue processing extended querystring using @TypedQuery decorator since you are using URLSearchParams for parsing querystring

Summary

When sending complex querystring like foo[0][type]=a&foo[0][value]=foo&foo[1][type]=b&foo[1][value]=bar nestia is unable to parse it using @TypedQuery decorator

Write detailed description in here.

In src/decorators/TypedQuery.ts you are parsing request.query using URLSearchParams however it does not support extended query strings.

I suggest changing a functionality to using already parsed QueryString from request.query if already parsed by middleware querystring parser and then change the validation logic accordingly to accept object instead of URLSearchParams instance

const params: object = request.query && typeof request.query === 'object' ? request.query : new URLSearchParams(tail(request.url)).searchParams;

Metadata

Assignees

Labels

duplicateThis issue or pull request already existsenhancementNew feature or requestgood first issueGood for newcomersinvalidThis doesn't seem rightquestionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions