mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[superagent] Add #maxResponseSize method to SuperAgent.Request (#33668)
This commit is contained in:
parent
a0ac17fe07
commit
cfb61d28ad
1
types/superagent/index.d.ts
vendored
1
types/superagent/index.d.ts
vendored
@ -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;
|
||||
|
||||
@ -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('/')
|
||||
|
||||
1
types/superagent/v2/index.d.ts
vendored
1
types/superagent/v2/index.d.ts
vendored
@ -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;
|
||||
|
||||
@ -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('/')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user