Add support for a global context option (#1256)

This commit is contained in:
Tomas Della Vedova
2020-07-13 14:36:53 +02:00
committed by delvedor
parent 28f2be397c
commit d73cb1a29b
16 changed files with 2995 additions and 1776 deletions

View File

@ -5,7 +5,7 @@
import { expectType, expectNotType, expectError } from 'tsd'
import { Client, RequestEvent, ResurrectEvent, ApiError, ApiResponse } from '../../'
import { KibanaClient } from '../../api/kibana'
import { TransportRequestPromise } from '../../lib/Transport'
import { TransportRequestPromise, Context } from '../../lib/Transport'
const client: KibanaClient = new Client({
node: 'http://localhost:9200'
@ -36,7 +36,7 @@ client.on('resurrect', (err, meta) => {
const response = await client.cat.count({ index: 'test' })
expectType<Record<string, any>>(response.body)
expectType<unknown>(response.meta.context)
expectType<Context>(response.meta.context)
}
// Define only the response body
@ -44,7 +44,7 @@ client.on('resurrect', (err, meta) => {
const response = await client.cat.count<string>({ index: 'test' })
expectType<string>(response.body)
expectType<unknown>(response.meta.context)
expectType<Context>(response.meta.context)
}
// Define response body and the context