"use strict";
(() => {
var exports = {};
exports.id = 638;
exports.ids = [638];
exports.modules = {

/***/ 2167:
/***/ ((module) => {

module.exports = require("axios");

/***/ }),

/***/ 2799:
/***/ ((module) => {

module.exports = require("micro-cors");

/***/ }),

/***/ 4558:
/***/ ((module) => {

module.exports = require("next/config");

/***/ }),

/***/ 7686:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _vulcan_sql_catalog_server_utils_vulcanSQLAdapter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4216);
/* harmony import */ var _vulcan_sql_catalog_server_utils_errorCode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5373);
/* harmony import */ var micro_cors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2799);
/* harmony import */ var micro_cors__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(micro_cors__WEBPACK_IMPORTED_MODULE_2__);



const cors = micro_cors__WEBPACK_IMPORTED_MODULE_2__();
const handler = async (req, res)=>{
    const { method , query , url  } = req;
    if (method === "GET") {
        try {
            const querySuffix = url.includes("?") ? `?${url.split("?")[1]}` : "";
            const downloadPath = query.slug.join("/");
            const { data  } = await _vulcan_sql_catalog_server_utils_vulcanSQLAdapter__WEBPACK_IMPORTED_MODULE_0__/* .axiosInstance.get */ .b.get(downloadPath + querySuffix);
            res.setHeader("Content-Type", "application/octet-stream");
            res.status(200).send(data);
        } catch (error) {
            if (error instanceof _vulcan_sql_catalog_server_utils_errorCode__WEBPACK_IMPORTED_MODULE_1__/* .HttpError */ .o) {
                return res.status(error.status).json({
                    code: error.code
                });
            }
            throw error;
        }
    } else {
        res.status(404).end();
    }
};
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (cors(handler));


/***/ })

};
;

// load runtime
var __webpack_require__ = require("../../../webpack-api-runtime.js");
__webpack_require__.C(exports);
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
var __webpack_exports__ = __webpack_require__.X(0, [216], () => (__webpack_exec__(7686)));
module.exports = __webpack_exports__;

})();