"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeFetchMockConnectedTo = void 0;
function makeFetchMockConnectedTo(fastify) {
    return async (url, conf) => {
        const response = await fastify.inject({
            method: conf === null || conf === void 0 ? void 0 : conf.method,
            headers: conf === null || conf === void 0 ? void 0 : conf.headers,
            payload: conf === null || conf === void 0 ? void 0 : conf.body,
            path: new URL(url).pathname,
        });
        return {
            status: response.statusCode,
            statusText: response.statusMessage,
            text: async () => response.payload,
            json: async () => response.json(),
        };
    };
}
exports.makeFetchMockConnectedTo = makeFetchMockConnectedTo;
//# sourceMappingURL=fetch-mock.js.map