question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error when requesting route with params and query

See original GitHub issue

Describe the bug

The server hangs itself when I try to send a GET request to a route where I use req.params and req.query e.g./cats/:catId/moods?food=fish

To Reproduce

I prepared a small repo to reproduce that error.

git clone https://github.com/fabianmoronzirfas/tinyhttp-request-error.git
npm ci
npm run dev

In another session

curl --request GET \
  --url 'http://localhost:3000/cats/1/moods?food=fish' 

Expected behavior

I expect the console to log

  console.log(req.query);
  console.log(req.params);

and to return a response.

  res.json({ message: "add a query string", url: req.url });

Versions

  • node: v14.13.1
  • @tinyhttp/app: 0.5.6

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

Passing query parameter in nodejs but route is giving error
When you pass id as query parameters, it won't be able to match the path and hence you are receiving an error Can't...
Read more >
Return 400 if required query parameter is missing #251 - GitHub
If method and path in request match some route but don't contain mandatory query parameters I would expect a 400 error response rather...
Read more >
Error "Invalid value for query parameter" and failed to send a ...
CAUSE. This is because the request being sent is not in the correct format where there's a limitation for maxLength defined in the...
Read more >
Routing - hapi.dev
There are two query parameters here, name=ferris and location=chicago . In hapi, you can access query parameters by the request.query object. server.route({ ...
Read more >
FromQuery in rocket::request - Rust
pub trait FromQuery<'q>: Sized { type Error; fn from_query(query: ... For example, the parameter user is a trailing query parameter in the following...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found