UNPKG

@eggjs/supertest

Version:

SuperAgent driven library for testing HTTP servers

29 lines (28 loc) 853 B
import type { Server } from 'node:net'; import { agent as Agent } from 'superagent'; import { Test } from './test.js'; import type { AgentOptions, App } from './types.js'; /** * Initialize a new `TestAgent`. * * @param {Function|Server} app * @param {Object} options */ export declare class TestAgent extends Agent { #private; app: Server | string; _host: string; constructor(appOrListener: App, options?: AgentOptions); host(host: string): this; protected _testRequest(method: string, url: string): Test; delete(url: string): Test; del(url: string): Test; get(url: string): Test; head(url: string): Test; put(url: string): Test; post(url: string): Test; patch(url: string): Test; options(url: string): Test; trace(url: string): Test; } export declare const proxyAgent: typeof TestAgent;