got#Got TypeScript Examples
The following examples show how to use
got#Got.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: viera.ts From homebridge-vieramatic with Apache License 2.0 | 6 votes |
private constructor(ip: string, log: Logger | Console) {
this.address = ip
this.log = log
this.#client = got.extend({
headers: {
Accept: 'application/xml',
'Cache-Control': 'no-cache',
'Content-Type': 'application/xml; charset="utf-8"',
Host: `${this.address}:${VieraTV.port}`,
Pragma: 'no-cache'
},
prefixUrl: `http://${this.address}:${VieraTV.port}`,
retry: { limit: 0 },
timeout: { request: 1500 }
})
}
Example #2
Source File: request.ts From epicgames-freegames-node with MIT License | 6 votes |
export function newCookieJar(username: string): Got {
const cookieFilename = getCookiePath(username);
const fileExists = fs.existsSync(cookieFilename);
if (fileExists) {
let cookieData;
try {
cookieData = fs.readFileSync(cookieFilename, 'utf8');
const cookieTest = JSON.parse(cookieData);
if (Array.isArray(cookieTest)) {
L.info(`Converting ${cookieFilename} cookie format`);
const tcfsCookies = editThisCookieToToughCookieFileStore(cookieTest);
fs.writeFileSync(cookieFilename, JSON.stringify(tcfsCookies), 'utf8');
}
} catch (err) {
L.warn(err);
L.warn({ cookieData }, `Could not parse ${cookieFilename}, deleting it`);
fs.rmSync(cookieFilename, { force: true });
}
}
return got.extend({
cookieJar: getCookieJar(username) as ToughCookieJar,
responseType: 'json',
});
}
Example #3
Source File: viera.ts From homebridge-vieramatic with Apache License 2.0 | 5 votes |
#client: Got
Example #4
Source File: remarkable.ts From reMarkable-typescript with MIT License | 5 votes |
private gotClient: Got = got.extend(gotConfiguration);
Example #5
Source File: BlockFrostAPI.ts From blockfrost-js with Apache License 2.0 | 5 votes |
instance: Got;
Example #6
Source File: BlockFrostIPFS.ts From blockfrost-js with Apache License 2.0 | 5 votes |
instance: Got;
Example #7
Source File: got.ts From blockfrost-js with Apache License 2.0 | 5 votes |
getInstance = (
apiUrl: string,
options: ValidatedOptions,
userAgent: string | undefined,
rateLimiter: Bottleneck | undefined,
): Got => {
return got.extend({
hooks: {
beforeRequest: [
async hookOptions => {
if (rateLimiter) {
await rateLimiter.schedule(() => Promise.resolve(true));
}
if (options.debug) {
console.log(`${hookOptions.method} ${hookOptions.url}`);
}
},
],
beforeError: [
error => {
if (options.debug) {
console.error(error);
}
return error;
},
],
},
prefixUrl: apiUrl,
responseType: 'json',
http2: options.http2,
headers: {
project_id: options.projectId,
'User-Agent': userAgent,
},
retry: options.retrySettings,
timeout: {
request: options.requestTimeout,
},
});
}
Example #8
Source File: api.ts From eufy-security-client with MIT License | 5 votes |
private requestEufyCloud: Got;
Example #9
Source File: smtp4dev.ts From epicgames-freegames-node with MIT License | 5 votes |
private request: Got;
Example #10
Source File: api.ts From tarkov with MIT License | 5 votes |
public prod: Got;
Example #11
Source File: api.ts From tarkov with MIT License | 5 votes |
public launcher: Got;
Example #12
Source File: api.ts From tarkov with MIT License | 5 votes |
public trading: Got;
Example #13
Source File: api.ts From tarkov with MIT License | 5 votes |
public ragfair: Got;
Example #14
Source File: projects.remote.ts From relate with GNU General Public License v3.0 | 5 votes |
listSampleProjects(_fetch?: () => any | Got): Promise<List<ISampleProjectRest>> {
throw new NotSupportedError(`${RemoteProjects.name} does not support listing sample projects`);
}
Example #15
Source File: cartoonextra.ts From stremio-addons with MIT License | 5 votes |
private httpClient: Got;
Example #16
Source File: watchcartoononline.ts From stremio-addons with MIT License | 5 votes |
private httpClient: Got;