"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.resendAuthRequest = void 0;
const send_1 = require("../../test-run/request/send");
const testcafe_hammerhead_1 = require("testcafe-hammerhead");
// @ts-ignore
const url_to_options_1 = __importDefault(require("url-to-options"));
async function resendAuthRequest(request, credentials) {
    const url = new URL(request.url);
    const urlRequestOptions = (0, url_to_options_1.default)(url);
    const requestOptions = new testcafe_hammerhead_1.RequestOptions(Object.assign(urlRequestOptions, {
        body: request.postData || '',
        auth: `${credentials.username}:${credentials.password}`,
        headers: request.headers,
        method: request.method,
    }));
    return (0, send_1.send)(requestOptions);
}
exports.resendAuthRequest = resendAuthRequest;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVzZW5kQXV0aFJlcXVlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvcHJveHlsZXNzL3JlcXVlc3QtcGlwZWxpbmUvcmVzZW5kQXV0aFJlcXVlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBR0Esc0RBQW1EO0FBRW5ELDZEQUFxRDtBQUNyRCxhQUFhO0FBQ2Isb0VBQThDO0FBRXZDLEtBQUssVUFBVSxpQkFBaUIsQ0FBRSxPQUF3QixFQUFFLFdBQTRCO0lBQzNGLE1BQU0sR0FBRyxHQUFHLElBQUksR0FBRyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUVqQyxNQUFNLGlCQUFpQixHQUFHLElBQUEsd0JBQWdCLEVBQUMsR0FBRyxDQUFDLENBQUM7SUFFaEQsTUFBTSxjQUFjLEdBQUcsSUFBSSxvQ0FBYyxDQUFDLE1BQU0sQ0FBQyxNQUFNLENBQUMsaUJBQWlCLEVBQUU7UUFDdkUsSUFBSSxFQUFLLE9BQU8sQ0FBQyxRQU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