import { __awaiter, __rest } from "tslib";
import axios from "axios";
const proxy = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
    const { method, body } = req;
    const url = "https://" + req.url.slice("/api/cors/".length);
    const _a = req.headers, { host } = _a, headers = __rest(_a, ["host"]);
    const { data, status, headers: responseHeaders, } = yield axios({
        url,
        method: method.toLowerCase(),
        headers,
        data: body,
    });
    const { ["transfer-encoding"]: unused } = responseHeaders, response = __rest(responseHeaders, ["transfer-encoding"]);
    Object.entries(response).forEach(([key, val]) => {
        res.setHeader(key, val);
    });
    return res.status(status).send(data);
});
export default proxy;
//# sourceMappingURL=%5B...url%5D.js.map