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

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

Open
songpr opened this issue Dec 4, 2018 · 1 comment
Open

Comments

@songpr
Copy link

songpr commented Dec 4, 2018

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.

@michaelnisi
Copy link
Contributor

What if you’d copy the global query?

const query = Object.assign({ fields: "name,gender" }, client.query)
const options = { path: "/xxxxxxyyyy", query: query }

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