restify / restify/clients

query string in client is missing when there is query string in request

Open
#201 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
58
Forks
35
Avg merge
22h 4m
Merged PRs (30d)
10

Description

Code below is work!

const rest_clients = require('restify-clients');

let client= rest_clients.createJsonClient({
            url: 'https://graph.facebook.com',
            version: "3.2",
            query: {
                access_token: "xxx"
            }
        });

client.get("/xxxxxxyyyy", function (err, req, res, obj) {
                if (err) {
                    console.log(err);
                    reject(err);
                }
                 console.log(obj);
            });

but if I have more query in a request then.

let options = {path:"/xxxxxxyyyy", query:{fields:"name,gender}};
client.get(options , function (err, req, res, obj) {
                if (err) {
                    console.log(err);
                    reject(err);
                }
                 console.log(obj);
            });

this will not work since access_token query is gone.

Contributor guide

No contributing guide indexed for this repository

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

Start by reproducing the two createJsonClient and client.get examples, then inspect the client.get option handling and query construction. The fix is done when a request-level query such as fields is included without dropping the client-level access_token query, with the behavior verified by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.