ky
Version:
Tiny and elegant HTTP client based on the Fetch API
25 lines (22 loc) • 757 B
TypeScript
import type { KyRequest } from '../types/request.js';
import { KyError } from './KyError.js';
/**
Error thrown when the response body exceeds `maxResponseSize`. It has a `request` property with the `Request` object and a `maxResponseSize` property with the configured limit in bytes.
```
import ky, {isResponseSizeError} from 'ky';
try {
await ky('https://example.com/data', {maxResponseSize: 1024}).json();
} catch (error) {
if (isResponseSizeError(error)) {
console.log(`Response exceeded ${error.maxResponseSize} bytes`);
}
}
```
*/
export declare class ResponseSizeError extends KyError {
name: string;
request: KyRequest;
maxResponseSize: number;
constructor(request: Request, maxResponseSize: number);
}