restify / restify/node-restify

Query Params Got Modify

Open
#1,812 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10.7k
Forks
975
Avg merge
1d 6h
Merged PRs (30d)
5

Description

node: 6.x.x
restify: 6.2.3

I got some unmatch query params while requesting to my api. for example
if i hit http://myapi/content/1?verify=true&released=true
it suppose read as

{
  verify: 'true',
  released: 'true'
}

on the req.query
but instead i got

{
  verify: ['true', 'true'],
  released: 'true'
}

any ideas why this is happend ?

on my server config :

self._server.pre(cors.preflight);
self._server.use(cors.actual);
self._server.use(restify.plugins.queryParser({
   mapParams: true
}));
self._server.use(restify.plugins.bodyParser({
  mapParams: true
}));

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the request with the shown queryParser and bodyParser configuration, then trace how req.query is populated for repeated or duplicated parameters. Done means identifying why verify becomes an array while released does not, and documenting the expected behavior or the relevant configuration change.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.