import { Request } from 'firebase-functions/v1/https'; import { HttpRequestOptions } from '../http-types.js'; /** * Concrete request type used by v1 `firebase-functions` HTTPS handlers. * * @remarks * This is the Express-style `Request` re-exported for clarity and paired * with `node-mocks-http` so tests can construct realistic requests without * a running server. */ export type MockHttpRequest = Request; /** * Create a mocked HTTP request suitable for invoking v1 `https.onRequest` * handlers (and for building v1 `onCall` contexts upstream). * * @param options - High-level request options (method, URL, headers, body, etc.). * @returns A {@link MockHttpRequest} instance compatible with Express/Firebase v1. * * @remarks * - Defaults the HTTP method to **POST** when a body is provided, otherwise **GET**. * - Ensures headers are normalized to lowercase (Node convention). * - Synthesizes `content-type` and `content-length` if they’re missing. * - Populates `rawBody` with the exact bytes sent (stringified for objects/arrays) * to mirror Firebase’s request shape and allow signature verification flows. * * @example * ```ts * const req = mockHttpRequest({ * method: 'POST', * url: '/api/ping', * headers: { 'x-forwarded-proto': 'https' }, * body: { ping: true }, * }); * expect(req.method).toBe('POST'); * expect(req.get('content-type')).toMatch(/application\/json/i); * expect(req.rawBody).toBeInstanceOf(Buffer); * ``` */ export declare function mockHttpRequest(options?: HttpRequestOptions): MockHttpRequest; //# sourceMappingURL=mock-http-request.d.ts.map