Added toJSON method to Connection class (#849)

* Added toJSON method to Connection class

* Updated test

* Updated typings
This commit is contained in:
Tomas Della Vedova
2019-05-14 12:00:27 -04:00
committed by delvedor
parent 152e5c85b6
commit 1e8e09f47a
3 changed files with 27 additions and 0 deletions

View File

@ -794,3 +794,16 @@ test('Port handling', t => {
t.end()
})
test('Should not add agent and ssl to the serialized connection', t => {
const connection = new Connection({
url: new URL('http://localhost:9200')
})
t.strictEqual(
JSON.stringify(connection),
'{"url":"http://localhost:9200/","id":"http://localhost:9200/","headers":null,"deadCount":0,"resurrectTimeout":0,"_openRequests":0,"status":"alive","roles":{"master":true,"data":true,"ingest":true,"ml":false}}'
)
t.end()
})