[superagent] Add #maxResponseSize method to SuperAgent.Request (#33668)

This commit is contained in:
Jesse Rogers 2019-03-12 13:56:14 -04:00 committed by Wesley Wigham
parent a0ac17fe07
commit cfb61d28ad
4 changed files with 14 additions and 0 deletions

View File

@ -158,6 +158,7 @@ declare namespace request {
use(fn: Plugin): this;
withCredentials(): this;
write(data: string | Buffer, encoding?: string): this;
maxResponseSize(size: number): this;
}
type Plugin = (req: SuperAgentRequest) => void;

View File

@ -168,6 +168,12 @@ request.get('/user')
request.get('/user')
.accept('png');
// Setting max response size
request
.get('/search')
.maxResponseSize(1000)
.end(callback);
// Query strings
request
.post('/')

View File

@ -119,6 +119,7 @@ declare namespace request {
withCredentials(): this;
write(data: string | Buffer, encoding?: string): this;
parse(fn: (res: Response, callback: (err: Error | null, body: any) => void) => void): this;
maxResponseSize(size: number): this;
}
type Plugin = (req: Request) => void;

View File

@ -163,6 +163,12 @@ request.get('/user')
request.get('/user')
.accept('png');
// Setting max response size
request
.get('/search')
.maxResponseSize(1000)
.end(callback);
// Query strings
request
.post('/')