mockttp
Version:
Mock HTTP server for testing HTTP clients and stubbing webservices
55 lines (46 loc) • 1.58 kB
TypeScript
// We use a custom type definition for this due to https://github.com/kenchris/urlpattern-polyfill/issues/135.
// Without this, this conflicts with the v24 Node.js type definitions. This would still cause big problems if
// we expose URLPattern in any of our own APIs & type definitions, but fortunately we don't (at time of writing)
export type URLPatternInput = URLPatternInit | string;
export declare class URLPattern {
constructor(init?: URLPatternInput, baseURL?: string);
test(input?: URLPatternInput, baseURL?: string): boolean;
exec(input?: URLPatternInput, baseURL?: string): URLPatternResult | null;
readonly protocol: string;
readonly username: string;
readonly password: string;
readonly hostname: string;
readonly port: string;
readonly pathname: string;
readonly search: string;
readonly hash: string;
readonly hasRegExpGroups: boolean;
}
interface URLPatternInit {
baseURL?: string;
username?: string;
password?: string;
protocol?: string;
hostname?: string;
port?: string;
pathname?: string;
search?: string;
hash?: string;
}
export interface URLPatternResult {
inputs: [URLPatternInput];
protocol: URLPatternComponentResult;
username: URLPatternComponentResult;
password: URLPatternComponentResult;
hostname: URLPatternComponentResult;
port: URLPatternComponentResult;
pathname: URLPatternComponentResult;
search: URLPatternComponentResult;
hash: URLPatternComponentResult;
}
export interface URLPatternComponentResult {
input: string;
groups: {
[key: string]: string | undefined;
};
}