We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
if (isFunction(rawResponse)) { await rawResponse.bind(self)(req, res); } else { const body = await parseJson(req); res.setHeader("Content-Type", "application/json"); res.statusCode = statusCode || 200; const mockResponse = isFunction(response) ? response.bind(self)({url: req.url, body, query, headers: req.headers}) : response; res.end(JSON.stringify(_mockjs2.default.mock(mockResponse))); }
我们公司的项目,有一批mock的api接口比较通用,可以给多个产品提供服务。
但,JSON 请求时,无法修改headers,导致不能解决跨域问题。
我们公司临时解决方案是dockerfile里用命令修改 node_modules/vite-plugin-mock/dist/index.js 文件:
res.setHeader("Access-Control-Allow-Origin", "*");
希望能够支持配置 headers
The text was updated successfully, but these errors were encountered:
临时修改,你可以用patch-package也行。
Sorry, something went wrong.
有类型需求,希望增加允许跨域设置
No branches or pull requests
我们公司的项目,有一批mock的api接口比较通用,可以给多个产品提供服务。
但,JSON 请求时,无法修改headers,导致不能解决跨域问题。
我们公司临时解决方案是dockerfile里用命令修改 node_modules/vite-plugin-mock/dist/index.js 文件:
希望能够支持配置 headers
The text was updated successfully, but these errors were encountered: