[Backport 7.x] Fixed transport.request querystring type (#1241)
Co-authored-by: Tomas Della Vedova <delvedor@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
91ba1c3b6e
commit
bd6f4f256b
2
lib/Transport.d.ts
vendored
2
lib/Transport.d.ts
vendored
@ -80,7 +80,7 @@ export interface TransportRequestParams {
|
|||||||
path: string;
|
path: string;
|
||||||
body?: RequestBody;
|
body?: RequestBody;
|
||||||
bulkBody?: RequestNDBody;
|
bulkBody?: RequestNDBody;
|
||||||
querystring?: Record<string, any>;
|
querystring?: Record<string, any> | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TransportRequestOptions {
|
export interface TransportRequestOptions {
|
||||||
|
|||||||
@ -102,6 +102,16 @@ expectType<Transport>(transport)
|
|||||||
|
|
||||||
expectType<TransportRequestCallback>(transport.request(params, options, (err, result) => {}))
|
expectType<TransportRequestCallback>(transport.request(params, options, (err, result) => {}))
|
||||||
|
|
||||||
|
// querystring as string
|
||||||
|
transport.request({
|
||||||
|
method: 'GET',
|
||||||
|
path: '/search',
|
||||||
|
querystring: 'baz=faz'
|
||||||
|
}, options, (err, result) => {
|
||||||
|
expectType<ApiError>(err)
|
||||||
|
expectType<ApiResponse>(result)
|
||||||
|
})
|
||||||
|
|
||||||
// body as object
|
// body as object
|
||||||
transport.request(params, options, (err, result) => {
|
transport.request(params, options, (err, result) => {
|
||||||
expectType<ApiError>(err)
|
expectType<ApiError>(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user