Skip to content
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

ContextRequest doesn't have right types #153

Open
Paradoxu opened this issue Dec 18, 2020 · 1 comment
Open

ContextRequest doesn't have right types #153

Paradoxu opened this issue Dec 18, 2020 · 1 comment

Comments

@Paradoxu
Copy link

When accessing the data directly from the ContextRequest, it is returning me a json with the wrong data types, example:

@Path("person")
export class PersonService {
    @GET
    @Path(':id')
    public getPerson(@ContextRequest req: express.Request) {
        console.log(req.query); // { id: "321" }
        console.log(req.params); // { id: "123" }
    }
}

But when I get them using @QueryParam or @PathParam they have the right type which is number, why is that happening? I like the idea of having decorators for getting specific parameters, but it would be nice to have one like @Query, that would return the object received on the query from express, I may have too many arguments on the query, and it's not pretty to get each of them using @QueryParam.

Example of request that generate this:
http://localhost/person/123?id=321

Version used:
3.0.2

@thiagobustamante
Copy link
Owner

it would be nice to have one like @query, that would return the object received on the query from express

I think it is a great feature. We could include this in a future version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants