-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add asStream support #34
Conversation
@@ -47,6 +49,7 @@ export type { | |||
} from './lib/pool' | |||
|
|||
export type { | |||
TransportOptions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @mshustov @pgayvallet now we are exporting the TransportOptions
as well! 🎉
@@ -109,7 +113,9 @@ export default class Connection extends BaseConnection { | |||
this.pool = new Pool(this.url.toString(), undiciOptions) | |||
} | |||
|
|||
async request (params: ConnectionRequestParams, options: ConnectionRequestOptions): Promise<ConnectionRequestResponse> { | |||
async request (params: ConnectionRequestParams, options: ConnectionRequestOptions): Promise<ConnectionRequestResponse> | |||
async request (params: ConnectionRequestParams, options: ConnectionRequestOptionsAsStream): Promise<ConnectionRequestResponseAsStream> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't it mean that we need to re-generate all the API type definitions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, the connection.request
is only used by the transport, and its signature hasn't changed.
In the client you might need to use directly client.transport.request<Readable>
, as the surface API assumes you are using JSON.
With this option, the transport will return a readable stream directly from the HTTP layer, it won't try to parse it or decompress it.
The response size check won't be executed.
Closes: elastic/elasticsearch-js#1597