@paultaku/node-mock-server
Version:
A TypeScript-based mock server with automatic Swagger-based mock file generation
36 lines • 1.04 kB
TypeScript
/**
* Response Renderer
*
* Renders mock responses from JSON files.
* Handles status codes, headers, delays, and body content.
*/
/**
* Mock response structure from JSON files
*/
export interface MockResponse {
header?: Array<{
key: string;
value: string;
}>;
body: unknown;
}
/**
* Read a mock response file
* @param filePath - Path to mock JSON file
* @returns Parsed mock response
*/
export declare function readMockResponse(filePath: string): Promise<MockResponse>;
/**
* Extract HTTP status code from mock filename
* Filenames follow pattern: description-{statusCode}.json
* @param mockFileName - Mock file name
* @returns HTTP status code or null if not found
*/
export declare function extractStatusCode(mockFileName: string): number | null;
/**
* Check if a mock file exists
* @param mockFilePath - Full path to mock file
* @returns True if file exists
*/
export declare function mockFileExists(mockFilePath: string): Promise<boolean>;
//# sourceMappingURL=response-renderer.d.ts.map