Updated test

This commit is contained in:
delvedor
2019-02-19 09:34:14 +01:00
parent 665ea3999d
commit a8f861c4d4
2 changed files with 44 additions and 1 deletions

View File

@ -6,9 +6,12 @@ import {
EventMeta,
SniffMeta,
ResurrectMeta,
events
events,
ClientExtendsCallbackOptions
} from '../../index'
import { TransportRequestParams, TransportRequestOptions } from '../../lib/Transport'
const client = new Client({ node: 'http://localhost:9200' })
client.on(events.REQUEST, (err: Error | null, meta: EventMeta) => {})
@ -65,3 +68,21 @@ client.index({
})
.then((result: ApiResponse) => {})
.catch((err: Error) => {})
// extend client
client.extend('namespace.method', (options: ClientExtendsCallbackOptions) => {
return function (params: any) {
const requestParams: TransportRequestParams = {
method: 'GET',
path: '/',
querystring: {}
}
const requestOptions: TransportRequestOptions = {
ignore: [404],
maxRetries: 5
}
return options.makeRequest(requestParams, requestOptions)
}
})