mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
🤖 Merge PR #63567 [got] Remove types by @BendingBender
* [got] Remove types * Change Bluebird dep from 2->3 This isn't strictly accurate, but makes the types work out, since p-cancelable's types, a transitive dependency of got, have a Promise.cancel return type that conflicts with bluebird@2's. Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
This commit is contained in:
@@ -23,7 +23,6 @@ download("unicorn.com/foo.jpg", "dest", {
|
||||
encoding: "utf8",
|
||||
followRedirect: true,
|
||||
query: "",
|
||||
retries: (retry, error) => 4,
|
||||
timeout: {
|
||||
connect: 20,
|
||||
request: 20,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"form-data": "^2.5.0"
|
||||
"@types/got": "^9"
|
||||
}
|
||||
}
|
||||
@@ -14,12 +14,7 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"got": [
|
||||
"got/v8"
|
||||
]
|
||||
}
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
|
||||
@@ -54,7 +54,6 @@ gotResume({
|
||||
});
|
||||
gotResume({ url: "http://test.com", transform: zlib.createGzip() }); // $ExpectType TransferStream
|
||||
gotResume({ url: "http://test.com", log: console.log }); // $ExpectType TransferStream
|
||||
gotResume({ url: "http://test.com", got: { baseUrl: "foo" } }); // $ExpectType TransferStream
|
||||
// @ts-expect-error
|
||||
gotResume({});
|
||||
|
||||
@@ -91,20 +90,19 @@ gotResume("http://test.com", {
|
||||
});
|
||||
gotResume("http://test.com", { transform: zlib.createGzip() }); // $ExpectType TransferStream
|
||||
gotResume("http://test.com", { log: console.log }); // $ExpectType TransferStream
|
||||
gotResume("http://test.com", { got: { baseUrl: "foo" } }); // $ExpectType TransferStream
|
||||
gotResume("http://test.com", {}); // $ExpectType TransferStream
|
||||
// @ts-expect-error
|
||||
gotResume("http://test.com", { url: "foo" });
|
||||
|
||||
gotResume.toFile("foo", { url: "http://test.com" }); // $ExpectType Promise<void>
|
||||
// $ExpectType Promise<void>
|
||||
// $ExpectType Bluebird<void>
|
||||
gotResume.toFile("foo", {
|
||||
url: "http://test.com",
|
||||
onProgress(progress) {
|
||||
progress; // $ExpectType Progress
|
||||
},
|
||||
});
|
||||
// $ExpectType Promise<void>
|
||||
// $ExpectType Bluebird<void>
|
||||
gotResume.toFile("foo", {
|
||||
url: "http://test.com",
|
||||
onResponse(response) {
|
||||
@@ -119,13 +117,13 @@ gotResume.toFile("foo", {});
|
||||
// toFile() tests
|
||||
|
||||
gotResume.toFile("foo", "http://test.com"); // $ExpectType Promise<void>
|
||||
// $ExpectType Promise<void>
|
||||
// $ExpectType Bluebird<void>
|
||||
gotResume.toFile("foo", "http://test.com", {
|
||||
onProgress(progress) {
|
||||
progress; // $ExpectType Progress
|
||||
},
|
||||
});
|
||||
// $ExpectType Promise<void>
|
||||
// $ExpectType Bluebird<void>
|
||||
gotResume.toFile("foo", "http://test.com", {
|
||||
onResponse(response) {
|
||||
response; // $ExpectType IncomingMessage
|
||||
@@ -168,7 +166,7 @@ transfer.options; // $ExpectType ToFileOptions & Partial<WithUrl>
|
||||
transfer.url; // $ExpectType string | undefined
|
||||
transfer.length; // $ExpectType number | undefined
|
||||
transfer.log; // $ExpectType (...args: unknown[]) => void
|
||||
transfer.gotOptions; // $ExpectType GotOptions<string | null>
|
||||
transfer.gotOptions; // $ExpectType Options
|
||||
transfer.idleTimeout; // $ExpectType number | undefined
|
||||
|
||||
transfer.attempt; // $ExpectType number
|
||||
@@ -182,7 +180,7 @@ transfer.res; // $ExpectType IncomingMessage | undefined
|
||||
transfer.err; // $ExpectType Error | undefined
|
||||
transfer.lastMod; // $ExpectType string | undefined
|
||||
transfer.etag; // $ExpectType string | undefined
|
||||
transfer.prePromise; // $ExpectType Promise<void> | undefined
|
||||
transfer.prePromise; // $ExpectType Bluebird<void> | undefined
|
||||
transfer.waitTimer; // $ExpectType number | undefined
|
||||
transfer.stream; // $ExpectType TransferStream
|
||||
|
||||
|
||||
78
types/got-resume/index.d.ts
vendored
78
types/got-resume/index.d.ts
vendored
@@ -4,10 +4,10 @@
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { GotOptions } from "got";
|
||||
import { ClientRequest, IncomingMessage } from "http";
|
||||
import { PassThrough, Transform } from "stream";
|
||||
import Promise = require("bluebird");
|
||||
import { Options } from 'got';
|
||||
import { ClientRequest, IncomingMessage } from 'http';
|
||||
import { PassThrough, Transform } from 'stream';
|
||||
import Promise = require('bluebird');
|
||||
|
||||
/**
|
||||
* Use [`got`](https://www.npmjs.com/package/got) to make an HTTP request with automatic retries for network errors.
|
||||
@@ -239,7 +239,7 @@ declare namespace gotResume {
|
||||
*
|
||||
* const stream = gotResume('http://google.com/', { got: { method: 'POST' } });
|
||||
*/
|
||||
got?: GotOptions<string | null> | undefined;
|
||||
got?: Options | undefined;
|
||||
}
|
||||
|
||||
interface TimeoutSpec {
|
||||
@@ -297,7 +297,7 @@ declare namespace gotResume {
|
||||
* Emitted with a `TransferError` on stream when transfer fails and has exhausted retries.
|
||||
*/
|
||||
addListener(
|
||||
event: "error",
|
||||
event: 'error',
|
||||
listener: (error: TransferError | CancelError | globalThis.Error) => any,
|
||||
): TransferStream;
|
||||
/**
|
||||
@@ -305,11 +305,11 @@ declare namespace gotResume {
|
||||
*
|
||||
* **NB** Is also emitted after error event if transfer fails.
|
||||
*/
|
||||
addListener(event: "end", listener: () => any): TransferStream;
|
||||
addListener(event: 'end', listener: () => any): TransferStream;
|
||||
/**
|
||||
* Emitted when data received.
|
||||
*/
|
||||
addListener(event: "progress", listener: (progress: Progress) => any): TransferStream;
|
||||
addListener(event: 'progress', listener: (progress: Progress) => any): TransferStream;
|
||||
/**
|
||||
* Emitted when first HTTP request made to server.
|
||||
*
|
||||
@@ -324,46 +324,46 @@ declare namespace gotResume {
|
||||
* const stream = gotResume('http://google.com/');
|
||||
* stream.on('response', res => console.log('Length: ', stream.transfer.length));
|
||||
*/
|
||||
addListener(event: "response", listener: (res: IncomingMessage) => any): TransferStream;
|
||||
addListener(event: 'response', listener: (res: IncomingMessage) => any): TransferStream;
|
||||
|
||||
on(event: "error", listener: (error: TransferError | CancelError | globalThis.Error) => any): TransferStream;
|
||||
on(event: "end", listener: () => any): TransferStream;
|
||||
on(event: "progress", listener: (progress: Progress) => any): TransferStream;
|
||||
on(event: "response", listener: (res: IncomingMessage) => any): TransferStream;
|
||||
on(event: 'error', listener: (error: TransferError | CancelError | globalThis.Error) => any): TransferStream;
|
||||
on(event: 'end', listener: () => any): TransferStream;
|
||||
on(event: 'progress', listener: (progress: Progress) => any): TransferStream;
|
||||
on(event: 'response', listener: (res: IncomingMessage) => any): TransferStream;
|
||||
|
||||
once(event: "error", listener: (error: TransferError | CancelError | globalThis.Error) => any): TransferStream;
|
||||
once(event: "end", listener: () => any): TransferStream;
|
||||
once(event: "progress", listener: (progress: Progress) => any): TransferStream;
|
||||
once(event: "response", listener: (res: IncomingMessage) => any): TransferStream;
|
||||
once(event: 'error', listener: (error: TransferError | CancelError | globalThis.Error) => any): TransferStream;
|
||||
once(event: 'end', listener: () => any): TransferStream;
|
||||
once(event: 'progress', listener: (progress: Progress) => any): TransferStream;
|
||||
once(event: 'response', listener: (res: IncomingMessage) => any): TransferStream;
|
||||
|
||||
prependListener(
|
||||
event: "error",
|
||||
event: 'error',
|
||||
listener: (error: TransferError | CancelError | globalThis.Error) => any,
|
||||
): TransferStream;
|
||||
prependListener(event: "end", listener: () => any): TransferStream;
|
||||
prependListener(event: "progress", listener: (progress: Progress) => any): TransferStream;
|
||||
prependListener(event: "response", listener: (res: IncomingMessage) => any): TransferStream;
|
||||
prependListener(event: 'end', listener: () => any): TransferStream;
|
||||
prependListener(event: 'progress', listener: (progress: Progress) => any): TransferStream;
|
||||
prependListener(event: 'response', listener: (res: IncomingMessage) => any): TransferStream;
|
||||
|
||||
prependOnceListener(
|
||||
event: "error",
|
||||
event: 'error',
|
||||
listener: (error: TransferError | CancelError | globalThis.Error) => any,
|
||||
): TransferStream;
|
||||
prependOnceListener(event: "end", listener: () => any): TransferStream;
|
||||
prependOnceListener(event: "progress", listener: (progress: Progress) => any): TransferStream;
|
||||
prependOnceListener(event: "response", listener: (res: IncomingMessage) => any): TransferStream;
|
||||
prependOnceListener(event: 'end', listener: () => any): TransferStream;
|
||||
prependOnceListener(event: 'progress', listener: (progress: Progress) => any): TransferStream;
|
||||
prependOnceListener(event: 'response', listener: (res: IncomingMessage) => any): TransferStream;
|
||||
|
||||
removeListener(
|
||||
event: "error",
|
||||
event: 'error',
|
||||
listener: (error: TransferError | CancelError | globalThis.Error) => any,
|
||||
): TransferStream;
|
||||
removeListener(event: "end", listener: () => any): TransferStream;
|
||||
removeListener(event: "progress", listener: (progress: Progress) => any): TransferStream;
|
||||
removeListener(event: "response", listener: (res: IncomingMessage) => any): TransferStream;
|
||||
removeListener(event: 'end', listener: () => any): TransferStream;
|
||||
removeListener(event: 'progress', listener: (progress: Progress) => any): TransferStream;
|
||||
removeListener(event: 'response', listener: (res: IncomingMessage) => any): TransferStream;
|
||||
|
||||
off(event: "error", listener: (error: TransferError | CancelError | globalThis.Error) => any): TransferStream;
|
||||
off(event: "end", listener: () => any): TransferStream;
|
||||
off(event: "progress", listener: (progress: Progress) => any): TransferStream;
|
||||
off(event: "response", listener: (res: IncomingMessage) => any): TransferStream;
|
||||
off(event: 'error', listener: (error: TransferError | CancelError | globalThis.Error) => any): TransferStream;
|
||||
off(event: 'end', listener: () => any): TransferStream;
|
||||
off(event: 'progress', listener: (progress: Progress) => any): TransferStream;
|
||||
off(event: 'response', listener: (res: IncomingMessage) => any): TransferStream;
|
||||
} & PassThrough;
|
||||
|
||||
interface Progress {
|
||||
@@ -372,23 +372,23 @@ declare namespace gotResume {
|
||||
}
|
||||
|
||||
class Error extends globalThis.Error {
|
||||
name: "GotResumeError";
|
||||
name: 'GotResumeError';
|
||||
}
|
||||
|
||||
class OptionsError extends globalThis.Error {
|
||||
name: "GotResumeOptionsError";
|
||||
name: 'GotResumeOptionsError';
|
||||
}
|
||||
|
||||
class TransferError extends globalThis.Error {
|
||||
name: "GotResumeTransferError";
|
||||
name: 'GotResumeTransferError';
|
||||
}
|
||||
|
||||
class CancelError extends globalThis.Error {
|
||||
name: "GotResumeCancelError";
|
||||
name: 'GotResumeCancelError';
|
||||
}
|
||||
|
||||
class PreError extends globalThis.Error {
|
||||
name: "GotResumePreError";
|
||||
name: 'GotResumePreError';
|
||||
}
|
||||
|
||||
class Transfer {
|
||||
@@ -398,7 +398,7 @@ declare namespace gotResume {
|
||||
/** Length of options passed to constructor. */
|
||||
length?: number | undefined;
|
||||
log: (...args: unknown[]) => void;
|
||||
gotOptions: GotOptions<string | null>;
|
||||
gotOptions: Options;
|
||||
idleTimeout?: number | undefined;
|
||||
|
||||
attempt: number;
|
||||
|
||||
@@ -10,12 +10,7 @@
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"paths": {
|
||||
"bluebird": [
|
||||
"bluebird/v2"
|
||||
]
|
||||
}
|
||||
"types": []
|
||||
},
|
||||
"files": [
|
||||
"got-resume-tests.ts",
|
||||
|
||||
@@ -1,465 +0,0 @@
|
||||
import got = require('got');
|
||||
import cookie = require('cookie');
|
||||
import FormData = require('form-data');
|
||||
import * as fs from 'fs';
|
||||
import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
import * as url from 'url';
|
||||
import tough = require('tough-cookie');
|
||||
|
||||
let str: string;
|
||||
let buf: Buffer;
|
||||
|
||||
got('todomvc.com')
|
||||
.then(response => {
|
||||
str = response.body;
|
||||
})
|
||||
.catch((error: got.GotError) => {
|
||||
console.log(error.response.body);
|
||||
});
|
||||
|
||||
got('todomvc.com').cancel();
|
||||
|
||||
got('todomvc.com').then((response) => {
|
||||
response.statusCode; // $ExpectType number
|
||||
response.statusMessage; // $ExpectType string
|
||||
});
|
||||
|
||||
got('todomvc.com', { json: true }).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', { json: true, body: {} }).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', { json: true, body: [{}] }).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', { json: true, form: true }).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', { json: true, form: true, encoding: null }).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', { json: true, form: true, encoding: null, hostname: 'todomvc' }).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', { form: true }).then(response => str = response.body);
|
||||
got('todomvc.com', { form: true, body: {} }).then(response => str = response.body);
|
||||
got('todomvc.com', { form: true, body: [{}] }).then(response => str = response.body);
|
||||
got('todomvc.com', { form: true, body: [{}], encoding: null }).then(response => buf = response.body);
|
||||
got('todomvc.com', { form: true, body: [{}], encoding: 'utf8' }).then(response => str = response.body);
|
||||
got('todomvc.com', {
|
||||
form: true,
|
||||
body: [{}],
|
||||
encoding: 'utf8',
|
||||
hostname: 'todomvc'
|
||||
}).then(response => str = response.body);
|
||||
got('todomvc.com', {
|
||||
form: true,
|
||||
body: [{}],
|
||||
encoding: 'utf8',
|
||||
hostname: 'todomvc',
|
||||
timeout: 2000
|
||||
}).then(response => str = response.body);
|
||||
got('todomvc.com', {
|
||||
form: true,
|
||||
body: [{}],
|
||||
encoding: 'utf8',
|
||||
hostname: 'todomvc',
|
||||
timeout: { connect: 20, request: 20, socket: 20 }
|
||||
}).then(response => str = response.body);
|
||||
// following must lead to type checking error: got('todomvc.com', {form: true, body: ''}).then(response => str = response.body);
|
||||
|
||||
got('todomvc.com', { encoding: null, hostname: 'todomvc' }).then(response => buf = response.body);
|
||||
got('todomvc.com', { encoding: 'utf8', hostname: 'todomvc' }).then(response => str = response.body);
|
||||
|
||||
got('todomvc.com', { hostname: 'todomvc' }).then(response => str = response.body);
|
||||
|
||||
got.get('todomvc.com', { hostname: 'todomvc' }).then(response => str = response.body);
|
||||
got.post('todomvc.com', { hostname: 'todomvc' }).then(response => str = response.body);
|
||||
got.put('todomvc.com', { hostname: 'todomvc' }).then(response => str = response.body);
|
||||
got.patch('todomvc.com', { hostname: 'todomvc' }).then(response => str = response.body);
|
||||
got.head('todomvc.com', { hostname: 'todomvc' }).then(response => str = response.body);
|
||||
got.delete('todomvc.com', { hostname: 'todomvc' }).then(response => str = response.body);
|
||||
|
||||
got.stream('todomvc.com').pipe(fs.createWriteStream('index.html'));
|
||||
|
||||
fs.createReadStream('index.html').pipe(got.stream.get('todomvc.com'));
|
||||
fs.createReadStream('index.html').pipe(got.stream.post('todomvc.com'));
|
||||
fs.createReadStream('index.html').pipe(got.stream.put('todomvc.com'));
|
||||
fs.createReadStream('index.html').pipe(got.stream.patch('todomvc.com'));
|
||||
fs.createReadStream('index.html').pipe(got.stream.head('todomvc.com'));
|
||||
fs.createReadStream('index.html').pipe(got.stream.delete('todomvc.com'));
|
||||
|
||||
let req: http.ClientRequest;
|
||||
let res: http.IncomingMessage | undefined;
|
||||
let opts: got.GotOptions<string | null>;
|
||||
let err: got.GotError;
|
||||
let href: string | undefined;
|
||||
let progress: got.Progress;
|
||||
|
||||
const stream = got.stream('todomvc.com');
|
||||
stream.addListener('request', (r) => req = r);
|
||||
stream.addListener('response', (r) => res = r);
|
||||
stream.addListener('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.addListener('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.addListener('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.addListener('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
stream.on('request', (r) => req = r);
|
||||
stream.on('response', (r) => res = r);
|
||||
stream.on('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.on('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.on('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.on('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
stream.once('request', (r) => req = r);
|
||||
stream.once('response', (r) => res = r);
|
||||
stream.once('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.once('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.once('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.once('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
stream.prependListener('request', (r) => req = r);
|
||||
stream.prependListener('response', (r) => res = r);
|
||||
stream.prependListener('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.prependListener('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.prependListener('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.prependListener('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
stream.prependOnceListener('request', (r) => req = r);
|
||||
stream.prependOnceListener('response', (r) => res = r);
|
||||
stream.prependOnceListener('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.prependOnceListener('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.prependOnceListener('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.prependOnceListener('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
stream.removeListener('request', (r) => req = r);
|
||||
stream.removeListener('response', (r) => res = r);
|
||||
stream.removeListener('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.removeListener('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.removeListener('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.removeListener('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
got('google.com', {
|
||||
headers: {
|
||||
cookie: cookie.serialize('foo', 'bar')
|
||||
}
|
||||
});
|
||||
|
||||
const form = new FormData();
|
||||
|
||||
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
|
||||
|
||||
got.post('google.com', {
|
||||
body: form
|
||||
});
|
||||
|
||||
got('todomvc.com', {
|
||||
headers: {
|
||||
'user-agent': `my-module/ (https://github.com/username/my-module)`
|
||||
}
|
||||
});
|
||||
|
||||
got('https://httpbin.org/404')
|
||||
.catch(err => err instanceof got.HTTPError && err.statusCode === 404);
|
||||
|
||||
got('todomvc', {
|
||||
throwHttpErrors: false
|
||||
});
|
||||
|
||||
got('todomvc', {
|
||||
agent: {
|
||||
http: new http.Agent(),
|
||||
https: new https.Agent()
|
||||
}
|
||||
});
|
||||
|
||||
got('todomvc', {
|
||||
cache: new Map(),
|
||||
}).then(res => res.fromCache);
|
||||
|
||||
declare const customCache: {
|
||||
set(key: string, value: any, ttl?: number): void;
|
||||
get(key: string): any;
|
||||
delete(key: string): void;
|
||||
};
|
||||
got('todomvc', {
|
||||
cache: customCache
|
||||
}).then(res => res.fromCache);
|
||||
|
||||
got(new url.URL('http://todomvc.com'));
|
||||
|
||||
got(url.parse('http://todomvc.com'));
|
||||
|
||||
got('https://todomvc.com', { rejectUnauthorized: false });
|
||||
|
||||
got('/examples/angularjs', { baseUrl: 'http://todomvc.com' });
|
||||
got('http://todomvc.com', { headers: { foo: 'bar' } });
|
||||
got('http://todomvc.com', { cookieJar: new tough.CookieJar() });
|
||||
|
||||
// Test extension
|
||||
got.extend({ method: 'POST' })('/example');
|
||||
got.extend({ method: 'POST' }).extend({ headers: {} }).stream('/example');
|
||||
|
||||
// JSON options:
|
||||
// $ExpectType Promise<any>
|
||||
got.extend({ json: true })('/example').then(({ body }) => body);
|
||||
// $ExpectType Promise<any>
|
||||
got.extend({ json: true })('/example', { query: {} }).then(({ body }) => body);
|
||||
// $ExpectType Promise<any>
|
||||
got.extend({ baseUrl: 'https://localhost' }).extend({ json: true })('/example').then(({ body }) => body);
|
||||
// $ExpectType Promise<string>
|
||||
got.extend({})('/example').then(({ body }) => body);
|
||||
// Form options:
|
||||
// $ExpectType Promise<Buffer>
|
||||
got.extend({ form: true, encoding: null })('/example').then(({ body }) => body);
|
||||
// $ExpectType Promise<Buffer>
|
||||
got.extend({ form: true, encoding: null })('/example', { query: {} }).then(({ body }) => body);
|
||||
// $ExpectType Promise<Buffer>
|
||||
got.extend({ form: true, encoding: null, body: {} })('/example').then(({ body }) => body);
|
||||
// $ExpectType Promise<string>
|
||||
got.extend({ form: true, encoding: 'utf8' })('/example').then(({ body }) => body);
|
||||
// $ExpectType Promise<string>
|
||||
got.extend({ form: true, encoding: 'utf8' })('/example', { query: {} }).then(({ body }) => body);
|
||||
// $ExpectType Promise<string>
|
||||
got.extend({ form: true, encoding: 'utf8', body: {} })('/example').then(({ body }) => body);
|
||||
// Body options:
|
||||
// $ExpectType Promise<Buffer>
|
||||
got.extend({ encoding: null })('/example').then(({ body }) => body);
|
||||
// $ExpectType Promise<Buffer>
|
||||
got.extend({ encoding: null, body: '{}' })('/example').then(({ body }) => body);
|
||||
// $ExpectType Promise<Buffer>
|
||||
got.extend({ encoding: null, body: '{}' })('/example', { query: {} }).then(({ body }) => body);
|
||||
// $ExpectType Promise<string>
|
||||
got.extend({ encoding: 'utf8' })('/example').then(({ body }) => body);
|
||||
// $ExpectType Promise<string>
|
||||
got.extend({ encoding: 'utf8', body: '{}' })('/example').then(({ body }) => body);
|
||||
// $ExpectType Promise<string>
|
||||
got.extend({ encoding: 'utf8', body: '{}' })('/example', { query: {} }).then(({ body }) => body);
|
||||
|
||||
// Test retry options.
|
||||
got('http://todomvc.com', { retry: 2 });
|
||||
got('http://todomvc.com', {
|
||||
retry: {
|
||||
retries: 2,
|
||||
methods: ['GET', 'POST'],
|
||||
statusCodes: [408, 504],
|
||||
maxRetryAfter: 1,
|
||||
errorCodes: ['ETIMEDOUT']
|
||||
}
|
||||
});
|
||||
// Test custom retry error code. See https://github.com/sindresorhus/got/blob/9f3a09948ff80057b12af0af60846cc5b8f0372d/test/retry.js#L155
|
||||
got('http://todomvc.com', {
|
||||
retry: {
|
||||
retries: 1,
|
||||
methods: ['GET'],
|
||||
errorCodes: ['OH_SNAP']
|
||||
}
|
||||
});
|
||||
|
||||
got('http://todomvc.com', { throwHttpErrors: false });
|
||||
|
||||
// Test timeout options.
|
||||
got('http://todomvc.com', { timeout: 1 });
|
||||
got('http://todomvc.com', {
|
||||
timeout: {
|
||||
lookup: 1,
|
||||
connect: 2,
|
||||
secureConnect: 3,
|
||||
socket: 4,
|
||||
response: 5,
|
||||
send: 6,
|
||||
request: 7
|
||||
}
|
||||
});
|
||||
|
||||
// Test got.TimeoutError.
|
||||
got('http://todomvc.com', { timeout: 1 }).catch((err) => err instanceof got.TimeoutError);
|
||||
|
||||
// Test hooks.
|
||||
got('example.com', {
|
||||
hooks: {
|
||||
init: [
|
||||
options => {
|
||||
options.baseUrl = 'https://google.com';
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
got('example.com', {
|
||||
hooks: {
|
||||
beforeRequest: [
|
||||
options => {
|
||||
options.headers!['x-foo'] = 'bar';
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
got('example.com', {
|
||||
hooks: {
|
||||
beforeRedirect: [
|
||||
options => {
|
||||
if (options.hostname === 'deadSite') {
|
||||
options.hostname = 'fallbackSite';
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
got('example.com', {
|
||||
hooks: {
|
||||
beforeRetry: [
|
||||
(options, error, retryCount) => {
|
||||
if (error instanceof got.HTTPError && error.statusCode === 413) { // Payload too large
|
||||
options.body = 'new body';
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
got('example.com', {
|
||||
hooks: {
|
||||
beforeError: [
|
||||
error => {
|
||||
return error;
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
got('example.com', {
|
||||
hooks: {
|
||||
afterResponse: [
|
||||
(response, retryWithMergedOptions) => {
|
||||
if (response.statusCode === 401) { // Unauthorized
|
||||
const updatedOptions = {
|
||||
headers: {
|
||||
token: 'new token' // Refresh the access token
|
||||
}
|
||||
};
|
||||
|
||||
// Make a new retry
|
||||
return retryWithMergedOptions(updatedOptions);
|
||||
}
|
||||
|
||||
// No changes otherwise
|
||||
return response;
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
// Test async hooks.
|
||||
{
|
||||
const doSomethingAsync = (): Promise<any> => {
|
||||
throw new Error('unimplemented');
|
||||
};
|
||||
|
||||
got('example.com', {
|
||||
hooks: {
|
||||
beforeRequest: [
|
||||
async () => {
|
||||
await doSomethingAsync();
|
||||
}
|
||||
],
|
||||
beforeRedirect: [
|
||||
async () => {
|
||||
await doSomethingAsync();
|
||||
}
|
||||
],
|
||||
beforeRetry: [
|
||||
async () => {
|
||||
await doSomethingAsync();
|
||||
}
|
||||
],
|
||||
beforeError: [
|
||||
async (error) => {
|
||||
await doSomethingAsync();
|
||||
return error;
|
||||
}
|
||||
],
|
||||
afterResponse: [
|
||||
async (response) => {
|
||||
await doSomethingAsync();
|
||||
return response;
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Test request option
|
||||
got('example.com', {
|
||||
request: https.request
|
||||
});
|
||||
382
types/got/index.d.ts
vendored
382
types/got/index.d.ts
vendored
@@ -1,382 +0,0 @@
|
||||
// Type definitions for got 9.6
|
||||
// Project: https://github.com/sindresorhus/got#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Linus Unnebäck <https://github.com/LinusU>
|
||||
// Konstantin Ikonnikov <https://github.com/ikokostya>
|
||||
// Stijn Van Nieuwenhuyse <https://github.com/stijnvn>
|
||||
// Matthew Bull <https://github.com/wingsbob>
|
||||
// Ryan Wilson-Perkin <https://github.com/ryanwilsonperkin>
|
||||
// Paul Hawxby <https://github.com/phawxby>
|
||||
// Ivy Witter <https://github.com/ivywit>
|
||||
// Huachao Mao <https://github.com/Huachao>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
// Got v10 comes bundled with typings so these should only be maintained for Got v9.
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
import { Url, URL, URLSearchParams } from 'url';
|
||||
import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
import * as nodeStream from 'stream';
|
||||
import { CookieJar } from 'tough-cookie';
|
||||
|
||||
export = got;
|
||||
|
||||
declare class RequestError extends StdError {
|
||||
name: 'RequestError';
|
||||
}
|
||||
|
||||
declare class ReadError extends StdError {
|
||||
name: 'ReadError';
|
||||
}
|
||||
|
||||
declare class ParseError extends StdError {
|
||||
name: 'ParseError';
|
||||
statusCode: number;
|
||||
statusMessage: string;
|
||||
}
|
||||
|
||||
declare class HTTPError extends StdError {
|
||||
name: 'HTTPError';
|
||||
statusCode: number;
|
||||
statusMessage: string;
|
||||
headers: http.IncomingHttpHeaders;
|
||||
body: Buffer | string | object;
|
||||
}
|
||||
|
||||
declare class MaxRedirectsError extends StdError {
|
||||
name: 'MaxRedirectsError';
|
||||
statusCode: number;
|
||||
statusMessage: string;
|
||||
redirectUrls: string[];
|
||||
}
|
||||
|
||||
declare class UnsupportedProtocolError extends StdError {
|
||||
name: 'UnsupportedProtocolError';
|
||||
}
|
||||
|
||||
declare class CancelError extends StdError {
|
||||
name: 'CancelError';
|
||||
}
|
||||
|
||||
declare class TimeoutError extends StdError {
|
||||
name: 'TimeoutError';
|
||||
event: keyof got.TimeoutOptions;
|
||||
}
|
||||
|
||||
declare class StdError extends Error {
|
||||
code?: string | undefined;
|
||||
host?: string | undefined;
|
||||
hostname?: string | undefined;
|
||||
method?: string | undefined;
|
||||
path?: string | undefined;
|
||||
protocol?: string | undefined;
|
||||
url?: string | undefined;
|
||||
response?: any;
|
||||
}
|
||||
|
||||
declare const got: got.GotInstance;
|
||||
|
||||
interface InternalRequestOptions extends https.RequestOptions {
|
||||
// Redeclare options with `any` type for allow specify types incompatible with http.RequestOptions.
|
||||
timeout?: any;
|
||||
agent?: any;
|
||||
}
|
||||
|
||||
declare namespace got {
|
||||
interface GotFn {
|
||||
(url: GotUrl): GotPromise<string>;
|
||||
(url: GotUrl, options: GotJSONOptions): GotPromise<any>;
|
||||
(url: GotUrl, options: GotFormOptions<string>): GotPromise<string>;
|
||||
(url: GotUrl, options: GotFormOptions<null>): GotPromise<Buffer>;
|
||||
(url: GotUrl, options: GotBodyOptions<string>): GotPromise<string>;
|
||||
(url: GotUrl, options: GotBodyOptions<null>): GotPromise<Buffer>;
|
||||
}
|
||||
|
||||
interface GotJSONFn {
|
||||
(url: GotUrl): GotPromise<any>;
|
||||
(url: GotUrl, options: Partial<GotJSONOptions>): GotPromise<any>;
|
||||
}
|
||||
|
||||
interface GotFormFn<T extends string | null> {
|
||||
(url: GotUrl): GotPromise<T extends null ? Buffer : string>;
|
||||
(url: GotUrl, options: Partial<GotFormOptions<T>>): GotPromise<T extends null ? Buffer : string>;
|
||||
}
|
||||
|
||||
interface GotBodyFn<T extends string | null> {
|
||||
(url: GotUrl): GotPromise<T extends null ? Buffer : string>;
|
||||
(url: GotUrl, options: GotBodyOptions<T>): GotPromise<T extends null ? Buffer : string>;
|
||||
}
|
||||
|
||||
type GotInstance<T = GotFn> = T &
|
||||
Record<'get' | 'post' | 'put' | 'patch' | 'head' | 'delete', T> &
|
||||
{
|
||||
stream: GotStreamFn & Record<'get' | 'post' | 'put' | 'patch' | 'head' | 'delete', GotStreamFn>;
|
||||
extend: GotExtend;
|
||||
RequestError: typeof RequestError;
|
||||
ReadError: typeof ReadError;
|
||||
ParseError: typeof ParseError;
|
||||
HTTPError: typeof HTTPError;
|
||||
MaxRedirectsError: typeof MaxRedirectsError;
|
||||
UnsupportedProtocolError: typeof UnsupportedProtocolError;
|
||||
CancelError: typeof CancelError;
|
||||
TimeoutError: typeof TimeoutError;
|
||||
};
|
||||
|
||||
interface GotExtend {
|
||||
(options: GotJSONOptions): GotInstance<GotJSONFn>;
|
||||
(options: GotFormOptions<string>): GotInstance<GotFormFn<string>>;
|
||||
(options: GotFormOptions<null>): GotInstance<GotFormFn<null>>;
|
||||
(options: GotBodyOptions<string>): GotInstance<GotBodyFn<string>>;
|
||||
(options: GotBodyOptions<null>): GotInstance<GotBodyFn<null>>;
|
||||
}
|
||||
|
||||
type GotStreamFn = (url: GotUrl, options?: GotOptions<string | null>) => GotEmitter & nodeStream.Duplex;
|
||||
|
||||
type GotUrl = string | https.RequestOptions | Url | URL;
|
||||
|
||||
/**
|
||||
* Hooks allow modifications during the request lifecycle. Hook functions may be async and are
|
||||
* run serially.
|
||||
*
|
||||
* @see https://github.com/sindresorhus/got#hooks
|
||||
* @template Options Request options.
|
||||
* @template Body Response body type.
|
||||
*/
|
||||
interface Hooks<Options, Body extends Buffer | string | object> {
|
||||
init?: Array<InitHook<Options>> | undefined;
|
||||
beforeRequest?: Array<BeforeRequestHook<Options>> | undefined;
|
||||
beforeRedirect?: Array<BeforeRedirectHook<Options>> | undefined;
|
||||
beforeRetry?: Array<BeforeRetryHook<Options>> | undefined;
|
||||
beforeError?: BeforeErrorHook[] | undefined;
|
||||
afterResponse?: Array<AfterResponseHook<Options, Body>> | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param options Unnormalized request options.
|
||||
*/
|
||||
type InitHook<Options> = (options: Options) => void;
|
||||
|
||||
/**
|
||||
* @param options Normalized request options.
|
||||
*/
|
||||
type BeforeRequestHook<Options> = (options: Options) => any;
|
||||
|
||||
/**
|
||||
* @param options Normalized request options.
|
||||
*/
|
||||
type BeforeRedirectHook<Options> = (options: Options) => any;
|
||||
|
||||
/**
|
||||
* @param options Normalized request options.
|
||||
* @param error Request error.
|
||||
* @param retryCount Number of retry.
|
||||
*/
|
||||
type BeforeRetryHook<Options> = (options: Options, error: GotError, retryCount: number) => any;
|
||||
|
||||
type BeforeErrorHook = (error: GotError) => Error | Promise<Error>;
|
||||
|
||||
/**
|
||||
* @param response Response object.
|
||||
* @param retryWithMergedOptions Retries request with the updated options.
|
||||
*/
|
||||
type AfterResponseHook<Options, Body extends Buffer | string | object> = (
|
||||
response: Response<Body>,
|
||||
retryWithMergedOptions: (updateOptions: Options) => GotPromise<Body>
|
||||
) => Response<Body> | Promise<Response<Body>>;
|
||||
|
||||
interface GotBodyOptions<E extends string | null> extends GotOptions<E> {
|
||||
body?: string | Buffer | nodeStream.Readable | undefined;
|
||||
hooks?: Hooks<GotBodyOptions<E>, string | Buffer | nodeStream.Readable> | undefined;
|
||||
}
|
||||
|
||||
interface GotJSONOptions extends GotOptions<string | null> {
|
||||
// Body must be an object or array. See https://github.com/sindresorhus/got/issues/511
|
||||
body?: object | undefined;
|
||||
form?: boolean | undefined;
|
||||
json: true;
|
||||
hooks?: Hooks<GotJSONOptions, object> | undefined;
|
||||
}
|
||||
|
||||
interface GotFormOptions<E extends string | null> extends GotOptions<E> {
|
||||
body?: Record<string, any> | undefined;
|
||||
form: true;
|
||||
json?: boolean | undefined;
|
||||
hooks?: Hooks<GotFormOptions<E>, Record<string, any>> | undefined;
|
||||
}
|
||||
|
||||
type RequestFunction = typeof https.request;
|
||||
|
||||
interface GotOptions<E extends string | null> extends InternalRequestOptions {
|
||||
baseUrl?: string | undefined;
|
||||
cookieJar?: CookieJar | undefined;
|
||||
encoding?: E | undefined;
|
||||
query?: Record<string, any> | URLSearchParams | string | undefined;
|
||||
timeout?: number | TimeoutOptions | undefined;
|
||||
retry?: number | RetryOptions | undefined;
|
||||
followRedirect?: boolean | undefined;
|
||||
decompress?: boolean | undefined;
|
||||
useElectronNet?: boolean | undefined;
|
||||
throwHttpErrors?: boolean | undefined;
|
||||
agent?: http.Agent | boolean | AgentOptions | undefined;
|
||||
cache?: Cache | undefined;
|
||||
request?: RequestFunction | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains properties to constrain the duration of each phase of the request lifecycle.
|
||||
*
|
||||
* @see https://github.com/sindresorhus/got#timeout
|
||||
*/
|
||||
interface TimeoutOptions {
|
||||
/**
|
||||
* Starts when a socket is assigned and ends when the hostname has been resolved. Does not
|
||||
* apply when using a Unix domain socket.
|
||||
*/
|
||||
lookup?: number | undefined;
|
||||
/**
|
||||
* Starts when `lookup` completes (or when the socket is assigned if lookup does not apply
|
||||
* to the request) and ends when the socket is connected.
|
||||
*/
|
||||
connect?: number | undefined;
|
||||
/**
|
||||
* Starts when `connect` completes and ends when the handshaking process completes (HTTPS
|
||||
* only).
|
||||
*/
|
||||
secureConnect?: number | undefined;
|
||||
/**
|
||||
* Starts when the socket is connected. See [request.setTimeout](https://nodejs.org/api/http.html#http_request_settimeout_timeout_callback).
|
||||
*/
|
||||
socket?: number | undefined;
|
||||
/**
|
||||
* Starts when the request has been written to the socket and ends when the response headers
|
||||
* are received.
|
||||
*/
|
||||
response?: number | undefined;
|
||||
/**
|
||||
* Starts when the socket is connected and ends with the request has been written to the
|
||||
* socket.
|
||||
*/
|
||||
send?: number | undefined;
|
||||
/**
|
||||
* Starts when the request is initiated and ends when the response's end event fires.
|
||||
*/
|
||||
request?: number | undefined;
|
||||
}
|
||||
|
||||
type RetryFunction = (retry: number, error: any) => number;
|
||||
|
||||
interface RetryOptions {
|
||||
retries?: number | RetryFunction | undefined;
|
||||
methods?: Array<'GET' | 'POST' | 'PUT' | 'HEAD' | 'DELETE' | 'OPTIONS' | 'TRACE'> | undefined;
|
||||
statusCodes?: Array<408 | 413 | 429 | 500 | 502 | 503 | 504> | undefined;
|
||||
maxRetryAfter?: number | undefined;
|
||||
/**
|
||||
* Allowed error codes.
|
||||
*/
|
||||
errorCodes?: string[] | undefined;
|
||||
}
|
||||
|
||||
interface AgentOptions {
|
||||
http: http.Agent;
|
||||
https: https.Agent;
|
||||
}
|
||||
|
||||
interface Cache {
|
||||
set(key: string, value: any, ttl?: number): any;
|
||||
get(key: string): any;
|
||||
delete(key: string): any;
|
||||
}
|
||||
|
||||
interface GotTimingsPhases {
|
||||
wait: number;
|
||||
dns: number;
|
||||
tcp: number;
|
||||
request: number;
|
||||
firstByte: number;
|
||||
download: number;
|
||||
total: number;
|
||||
}
|
||||
|
||||
interface GotTimings {
|
||||
start: number;
|
||||
socket: number;
|
||||
lookup: number;
|
||||
connect: number;
|
||||
upload: number;
|
||||
response: number;
|
||||
end: number;
|
||||
error: number;
|
||||
phases: GotTimingsPhases;
|
||||
}
|
||||
|
||||
interface Response<B extends Buffer | string | object> extends http.IncomingMessage {
|
||||
body: B;
|
||||
url: string;
|
||||
requestUrl: string;
|
||||
timings: GotTimings;
|
||||
fromCache: boolean;
|
||||
redirectUrls?: string[] | undefined;
|
||||
retryCount: number;
|
||||
|
||||
// got's Response is always a "response obtained from http.ClientRequest", therefore these two properties are never undefined
|
||||
statusCode: number;
|
||||
statusMessage: string;
|
||||
}
|
||||
|
||||
type GotPromise<B extends Buffer | string | object> = Promise<Response<B>> & { cancel(): void };
|
||||
|
||||
interface GotEmitter {
|
||||
addListener(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
addListener(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
addListener(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
addListener(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
addListener(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
addListener(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
|
||||
on(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
on(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
on(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
on(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
on(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
on(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
|
||||
once(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
once(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
once(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
once(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
once(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
once(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
|
||||
prependListener(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
prependListener(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
prependListener(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
prependListener(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
prependListener(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
prependListener(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
|
||||
prependOnceListener(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
prependOnceListener(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
prependOnceListener(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
prependOnceListener(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
prependOnceListener(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
prependOnceListener(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
|
||||
removeListener(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
removeListener(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
removeListener(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
removeListener(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
removeListener(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
removeListener(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
}
|
||||
|
||||
type GotError = RequestError | ReadError | ParseError | HTTPError | MaxRedirectsError | UnsupportedProtocolError | CancelError | TimeoutError;
|
||||
|
||||
interface Progress {
|
||||
percent: number;
|
||||
transferred: number;
|
||||
total: number | null;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"got-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "@definitelytyped/dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
@@ -1,261 +0,0 @@
|
||||
import got = require('got');
|
||||
import cookie = require('cookie');
|
||||
import FormData = require('form-data');
|
||||
import * as fs from 'fs';
|
||||
import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
import * as url from 'url';
|
||||
|
||||
let str: string;
|
||||
let buf: Buffer;
|
||||
|
||||
got('todomvc.com')
|
||||
.then(response => {
|
||||
str = response.body;
|
||||
})
|
||||
.catch((error: got.GotError) => {
|
||||
console.log(error.response.body);
|
||||
});
|
||||
|
||||
got('todomvc.com').cancel();
|
||||
|
||||
got('todomvc.com', {json: true}).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', {json: true, body: {}}).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', {json: true, body: [{}]}).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', {json: true, form: true}).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', {json: true, form: true, encoding: null}).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', {json: true, form: true, encoding: null, hostname: 'todomvc'}).then((response) => {
|
||||
response.body; // $ExpectType any
|
||||
});
|
||||
|
||||
got('todomvc.com', {form: true}).then(response => str = response.body);
|
||||
got('todomvc.com', {form: true, body: {}}).then(response => str = response.body);
|
||||
got('todomvc.com', {form: true, body: [{}]}).then(response => str = response.body);
|
||||
got('todomvc.com', {form: true, body: [{}], encoding: null}).then(response => buf = response.body);
|
||||
got('todomvc.com', {form: true, body: [{}], encoding: 'utf8'}).then(response => str = response.body);
|
||||
got('todomvc.com', {
|
||||
form: true,
|
||||
body: [{}],
|
||||
encoding: 'utf8',
|
||||
hostname: 'todomvc'
|
||||
}).then(response => str = response.body);
|
||||
got('todomvc.com', {
|
||||
form: true,
|
||||
body: [{}],
|
||||
encoding: 'utf8',
|
||||
hostname: 'todomvc',
|
||||
timeout: 2000
|
||||
}).then(response => str = response.body);
|
||||
got('todomvc.com', {
|
||||
form: true,
|
||||
body: [{}],
|
||||
encoding: 'utf8',
|
||||
hostname: 'todomvc',
|
||||
timeout: {connect: 20, request: 20, socket: 20}
|
||||
}).then(response => str = response.body);
|
||||
// following must lead to type checking error: got('todomvc.com', {form: true, body: ''}).then(response => str = response.body);
|
||||
|
||||
got('todomvc.com', {encoding: null, hostname: 'todomvc'}).then(response => buf = response.body);
|
||||
got('todomvc.com', {encoding: 'utf8', hostname: 'todomvc'}).then(response => str = response.body);
|
||||
|
||||
got('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body);
|
||||
|
||||
got.get('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body);
|
||||
got.post('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body);
|
||||
got.put('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body);
|
||||
got.patch('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body);
|
||||
got.head('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body);
|
||||
got.delete('todomvc.com', {hostname: 'todomvc'}).then(response => str = response.body);
|
||||
|
||||
got.stream('todomvc.com').pipe(fs.createWriteStream('index.html'));
|
||||
|
||||
fs.createReadStream('index.html').pipe(got.stream.get('todomvc.com'));
|
||||
fs.createReadStream('index.html').pipe(got.stream.post('todomvc.com'));
|
||||
fs.createReadStream('index.html').pipe(got.stream.put('todomvc.com'));
|
||||
fs.createReadStream('index.html').pipe(got.stream.patch('todomvc.com'));
|
||||
fs.createReadStream('index.html').pipe(got.stream.head('todomvc.com'));
|
||||
fs.createReadStream('index.html').pipe(got.stream.delete('todomvc.com'));
|
||||
|
||||
let req: http.ClientRequest;
|
||||
let res: http.IncomingMessage | undefined;
|
||||
let opts: got.GotOptions<string | null>;
|
||||
let err: got.GotError;
|
||||
let href: string | undefined;
|
||||
let progress: got.Progress;
|
||||
|
||||
const stream = got.stream('todomvc.com');
|
||||
stream.addListener('request', (r) => req = r);
|
||||
stream.addListener('response', (r) => res = r);
|
||||
stream.addListener('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.addListener('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.addListener('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.addListener('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
stream.on('request', (r) => req = r);
|
||||
stream.on('response', (r) => res = r);
|
||||
stream.on('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.on('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.on('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.on('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
stream.once('request', (r) => req = r);
|
||||
stream.once('response', (r) => res = r);
|
||||
stream.once('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.once('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.once('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.once('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
stream.prependListener('request', (r) => req = r);
|
||||
stream.prependListener('response', (r) => res = r);
|
||||
stream.prependListener('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.prependListener('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.prependListener('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.prependListener('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
stream.prependOnceListener('request', (r) => req = r);
|
||||
stream.prependOnceListener('response', (r) => res = r);
|
||||
stream.prependOnceListener('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.prependOnceListener('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.prependOnceListener('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.prependOnceListener('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
stream.removeListener('request', (r) => req = r);
|
||||
stream.removeListener('response', (r) => res = r);
|
||||
stream.removeListener('redirect', (r, o) => {
|
||||
res = r;
|
||||
opts = o;
|
||||
href = o.href;
|
||||
});
|
||||
stream.removeListener('error', (e, b, r) => {
|
||||
err = e;
|
||||
res = r;
|
||||
});
|
||||
stream.removeListener('downloadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
stream.removeListener('uploadProgress', (p) => {
|
||||
progress = p;
|
||||
});
|
||||
|
||||
got('google.com', {
|
||||
headers: {
|
||||
cookie: cookie.serialize('foo', 'bar')
|
||||
}
|
||||
});
|
||||
|
||||
const form = new FormData();
|
||||
|
||||
form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
|
||||
|
||||
got.post('google.com', {
|
||||
body: form
|
||||
});
|
||||
|
||||
got('todomvc.com', {
|
||||
headers: {
|
||||
'user-agent': `my-module/ (https://github.com/username/my-module)`
|
||||
}
|
||||
});
|
||||
|
||||
got('https://httpbin.org/404')
|
||||
.catch(err => err instanceof got.HTTPError && err.statusCode === 404);
|
||||
|
||||
got('todomvc', {
|
||||
throwHttpErrors: false
|
||||
});
|
||||
|
||||
got('todomvc', {
|
||||
agent: {
|
||||
http: new http.Agent(),
|
||||
https: new https.Agent()
|
||||
}
|
||||
});
|
||||
|
||||
got('todomvc', {
|
||||
cache: new Map(),
|
||||
}).then(res => res.fromCache);
|
||||
|
||||
declare const customCache: {
|
||||
set(key: string, value: any, ttl?: number): void;
|
||||
get(key: string): any;
|
||||
delete(key: string): void;
|
||||
};
|
||||
got('todomvc', {
|
||||
cache: customCache
|
||||
}).then(res => res.fromCache);
|
||||
|
||||
got(new url.URL('http://todomvc.com'));
|
||||
|
||||
got(url.parse('http://todomvc.com'));
|
||||
|
||||
got('https://todomvc.com', { rejectUnauthorized: false });
|
||||
208
types/got/v8/index.d.ts
vendored
208
types/got/v8/index.d.ts
vendored
@@ -1,208 +0,0 @@
|
||||
// Type definitions for got 8.3
|
||||
// Project: https://github.com/sindresorhus/got#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Linus Unnebäck <https://github.com/LinusU>
|
||||
// Konstantin Ikonnikov <https://github.com/ikokostya>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
import { Url, URL } from 'url';
|
||||
import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
import * as nodeStream from 'stream';
|
||||
|
||||
export = got;
|
||||
|
||||
declare class RequestError extends StdError {
|
||||
name: 'RequestError';
|
||||
}
|
||||
|
||||
declare class ReadError extends StdError {
|
||||
name: 'ReadError';
|
||||
}
|
||||
|
||||
declare class ParseError extends StdError {
|
||||
name: 'ParseError';
|
||||
statusCode: number;
|
||||
statusMessage: string;
|
||||
}
|
||||
|
||||
declare class HTTPError extends StdError {
|
||||
name: 'HTTPError';
|
||||
statusCode: number;
|
||||
statusMessage: string;
|
||||
headers: http.IncomingHttpHeaders;
|
||||
}
|
||||
|
||||
declare class MaxRedirectsError extends StdError {
|
||||
name: 'MaxRedirectsError';
|
||||
statusCode: number;
|
||||
statusMessage: string;
|
||||
redirectUrls: string[];
|
||||
}
|
||||
|
||||
declare class UnsupportedProtocolError extends StdError {
|
||||
name: 'UnsupportedProtocolError';
|
||||
}
|
||||
|
||||
declare class CancelError extends StdError {
|
||||
name: 'CancelError';
|
||||
}
|
||||
|
||||
declare class StdError extends Error {
|
||||
code?: string | undefined;
|
||||
host?: string | undefined;
|
||||
hostname?: string | undefined;
|
||||
method?: string | undefined;
|
||||
path?: string | undefined;
|
||||
protocol?: string | undefined;
|
||||
url?: string | undefined;
|
||||
response?: any;
|
||||
}
|
||||
|
||||
declare const got: got.GotFn &
|
||||
Record<'get' | 'post' | 'put' | 'patch' | 'head' | 'delete', got.GotFn> &
|
||||
{
|
||||
stream: got.GotStreamFn & Record<'get' | 'post' | 'put' | 'patch' | 'head' | 'delete', got.GotStreamFn>;
|
||||
RequestError: typeof RequestError;
|
||||
ReadError: typeof ReadError;
|
||||
ParseError: typeof ParseError;
|
||||
HTTPError: typeof HTTPError;
|
||||
MaxRedirectsError: typeof MaxRedirectsError;
|
||||
UnsupportedProtocolError: typeof UnsupportedProtocolError;
|
||||
CancelError: typeof CancelError;
|
||||
};
|
||||
|
||||
interface InternalRequestOptions extends https.RequestOptions {
|
||||
// Redeclare options with `any` type for allow specify types incompatible with http.RequestOptions.
|
||||
timeout?: any;
|
||||
agent?: any;
|
||||
}
|
||||
|
||||
declare namespace got {
|
||||
interface GotFn {
|
||||
(url: GotUrl): GotPromise<string>;
|
||||
(url: GotUrl, options: GotJSONOptions): GotPromise<any>;
|
||||
(url: GotUrl, options: GotFormOptions<string>): GotPromise<string>;
|
||||
(url: GotUrl, options: GotFormOptions<null>): GotPromise<Buffer>;
|
||||
(url: GotUrl, options: GotBodyOptions<string>): GotPromise<string>;
|
||||
(url: GotUrl, options: GotBodyOptions<null>): GotPromise<Buffer>;
|
||||
}
|
||||
|
||||
type GotStreamFn = (url: GotUrl, options?: GotOptions<string | null>) => GotEmitter & nodeStream.Duplex;
|
||||
|
||||
type GotUrl = string | https.RequestOptions | Url | URL;
|
||||
|
||||
interface GotBodyOptions<E extends string | null> extends GotOptions<E> {
|
||||
body?: string | Buffer | nodeStream.Readable | undefined;
|
||||
}
|
||||
|
||||
interface GotJSONOptions extends GotOptions<string | null> {
|
||||
// Body must be an object or array. See https://github.com/sindresorhus/got/issues/511
|
||||
body?: object | undefined;
|
||||
form?: boolean | undefined;
|
||||
json: true;
|
||||
}
|
||||
|
||||
interface GotFormOptions<E extends string | null> extends GotOptions<E> {
|
||||
body?: {[key: string]: any} | undefined;
|
||||
form: true;
|
||||
json?: boolean | undefined;
|
||||
}
|
||||
|
||||
interface GotOptions<E extends string | null> extends InternalRequestOptions {
|
||||
encoding?: E | undefined;
|
||||
query?: string | object | undefined;
|
||||
timeout?: number | TimeoutOptions | undefined;
|
||||
retries?: number | RetryFunction | undefined;
|
||||
followRedirect?: boolean | undefined;
|
||||
decompress?: boolean | undefined;
|
||||
useElectronNet?: boolean | undefined;
|
||||
cache?: Cache | undefined;
|
||||
agent?: http.Agent | boolean | AgentOptions | undefined;
|
||||
throwHttpErrors?: boolean | undefined;
|
||||
}
|
||||
|
||||
interface TimeoutOptions {
|
||||
connect?: number | undefined;
|
||||
socket?: number | undefined;
|
||||
request?: number | undefined;
|
||||
}
|
||||
|
||||
interface AgentOptions {
|
||||
http: http.Agent;
|
||||
https: https.Agent;
|
||||
}
|
||||
|
||||
type RetryFunction = (retry: number, error: any) => number;
|
||||
|
||||
interface Cache {
|
||||
set(key: string, value: any, ttl?: number): any;
|
||||
get(key: string): any;
|
||||
delete(key: string): any;
|
||||
}
|
||||
|
||||
interface Response<B extends Buffer | string | object> extends http.IncomingMessage {
|
||||
body: B;
|
||||
url: string;
|
||||
requestUrl: string;
|
||||
fromCache: boolean;
|
||||
redirectUrls?: string[] | undefined;
|
||||
}
|
||||
|
||||
type GotPromise<B extends Buffer | string | object> = Promise<Response<B>> & { cancel(): void };
|
||||
|
||||
interface GotEmitter {
|
||||
addListener(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
addListener(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
addListener(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
addListener(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
addListener(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
addListener(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
|
||||
on(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
on(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
on(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
on(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
on(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
on(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
|
||||
once(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
once(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
once(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
once(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
once(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
once(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
|
||||
prependListener(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
prependListener(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
prependListener(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
prependListener(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
prependListener(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
prependListener(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
|
||||
prependOnceListener(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
prependOnceListener(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
prependOnceListener(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
prependOnceListener(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
prependOnceListener(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
prependOnceListener(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
|
||||
removeListener(event: 'request', listener: (req: http.ClientRequest) => void): this;
|
||||
removeListener(event: 'response', listener: (res: http.IncomingMessage) => void): this;
|
||||
removeListener(event: 'redirect', listener: (res: http.IncomingMessage, nextOptions: GotOptions<string | null> & Url) => void): this;
|
||||
removeListener(event: 'error', listener: (error: GotError, body?: any, res?: http.IncomingMessage) => void): this;
|
||||
removeListener(event: 'downloadProgress', listener: (progress: Progress) => void): this;
|
||||
removeListener(event: 'uploadProgress', listener: (progress: Progress) => void): this;
|
||||
}
|
||||
|
||||
type GotError = RequestError | ReadError | ParseError | HTTPError | MaxRedirectsError | UnsupportedProtocolError | CancelError;
|
||||
|
||||
interface Progress {
|
||||
percent: number;
|
||||
transferred: number;
|
||||
total: number | null;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"types": [],
|
||||
"paths": {
|
||||
"got": [
|
||||
"got/v8"
|
||||
]
|
||||
},
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"got-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "@definitelytyped/dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"electron-store": ">=8.0.2"
|
||||
"electron-store": ">=8.0.2",
|
||||
"@types/got": "^9"
|
||||
}
|
||||
}
|
||||
|
||||
6
types/onionoo/package.json
Normal file
6
types/onionoo/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@types/got": "^9"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user