Repository: node-influx/node-influx (ts)

Issue:
Incorrect encoding when using placeholders / bind parameters
The `placeholders` is not correctly encoded in the request to the influx instance (see https://docs.influxdata.com/influxdb/v1.8/tools/api/#bind-parameters for expected encoding)
 
Using the following query: 

```
influx.query(
  'select * from response_times where host = $host', 
  { 
    placeholders: { host: 'example' } 
  }
);
```

## Expected Behavior

Query parameter `params` should be `params={ host: 'example' }`

## Actual Behavior

Query parameter `params` is  empty (`params=`)

## Details

When the path is built up in `pool.ts` on line 363, `querystring.stringify(options.query);` is used, and it does not support nested objects.  

In a scenario where `options.query` looks like the following:

```
const options = {
  query: {
    p: 'pwd',
    u: 'user',
    params: { host: 'example' }
  }
};

querystring.stringify(options.query) === 'p=pwd&u=user&params='
```

## Proposed solution

We need to call `JSON.stringify` on the `placeholders` object before we use `querystring.stringify()`

## Specifications

- Version: 5.6.3
- Platform: OS X


Pull request:
fix: #539 Incorrect encoding when using placeholders / bind parameters
Fixes #539 

---

## Checklist

- [ x ] A test has been added if appropriate
- [ x ] `npm test` completes successfully
- [ x ] Commit messages are in [semantic format](https://seesparkbox.com/foundry/semantic_commit_messages)


Patch:
diff --git a/src/index.ts b/src/index.ts
index 564babc..01cded4 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1513,7 +1513,7 @@ export class InfluxDB {
         epoch: options.precision,
         q: query,
         rp: retentionPolicy,
-        params: placeholders,
+        params: JSON.stringify(placeholders),
       })
     );
   }


Test patch:
diff --git a/test/unit/influx.test.ts b/test/unit/influx.test.ts
index aaa04b2..b20fa56 100644
--- a/test/unit/influx.test.ts
+++ b/test/unit/influx.test.ts
@@ -876,7 +876,7 @@ describe("influxdb", () => {
             epoch: undefined,
             rp: undefined,
             db: "my_db",
-            params: {},
+            params: "{}",
           },
           "GET",
           dbFixture("selectFromOne")
@@ -895,7 +895,7 @@ describe("influxdb", () => {
             epoch: undefined,
             rp: undefined,
             db: "my_db",
-            params: {},
+            params: "{}",
           },
           "GET",
           dbFixture("selectFromOne")
@@ -925,7 +925,7 @@ describe("influxdb", () => {
             epoch: undefined,
             rp: undefined,
             db: "my_db",
-            params: {},
+            params: "{}",
           },
           "GET",
           dbFixture("selectFromOne")
@@ -945,7 +945,7 @@ describe("influxdb", () => {
             epoch: "ms",
             rp: "asdf",
             db: "my_db",
-            params: {},
+            params: "{}",
           },
           "GET",
           dbFixture("selectFromOne")
@@ -965,7 +965,7 @@ describe("influxdb", () => {
             epoch: undefined,
             rp: "asdf",
             db: "my_db",
-            params: {},
+            params: "{}",
           },
           "GET",
           dbFixture("selectFromOne")
@@ -985,7 +985,7 @@ describe("influxdb", () => {
             epoch: undefined,
             rp: "asdf",
             db: "my_db",
-            params: { since: "10s" },
+            params: '{"since":"10s"}',
           },
           "GET",
           dbFixture("selectFromOne")