@rxx/http
Version:
Http IO module for rxx.
44 lines (43 loc) • 1.17 kB
TypeScript
/**
* @fileoverview IOのモッククラス定義
* @author Taketoshi Aono
*/
import { Advices } from '@rxx/core';
import { HttpHandler } from './http-handler';
/**
* Config for HttpRequestMock.
* If when undefined property was passed, return sended parameter as is.
*/
export declare type HttpHandlerMockOptions = {
/**
* Specify get method return value.
*/
get?: (uri: string, req: RequestInit) => Response;
/**
* Specify post method return value.
*/
post?: (uri: string, req: RequestInit) => Response;
/**
* Specify put method return value.
*/
put?: (uri: string, req: RequestInit) => Response;
/**
* Specify delete method return value.
*/
delete?: (uri: string, req: RequestInit) => Response;
};
/**
* Mock class for HttpRequest.
*/
export declare class HttpHandlerMock extends HttpHandler {
private methods;
private fetchFunction;
/**
* @param methods Definitions of each method return value.
*/
constructor(methods: HttpHandlerMockOptions, advices?: Advices);
/**
* Return whatwgFetch function mock.
*/
protected readonly fetch: any;
}