whistle.mock-plugins 1.0.6-beta.6 → 1.0.6-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -249,9 +249,9 @@ const ruleManager = {
249
249
  if (config.contentType && !res.getHeader('Content-Type')) {
250
250
  res.setHeader('Content-Type', config.contentType);
251
251
  }
252
-
253
252
  // 添加CORS支持 - 设置跨域相关的响应头
254
- res.setHeader('Access-Control-Allow-Origin', '*');
253
+ const origin = req.headers.origin || req.headers.host;
254
+ res.setHeader('Access-Control-Allow-Origin', origin || '*');
255
255
  res.setHeader('Access-Control-Allow-Credentials', 'true');
256
256
 
257
257
  // 添加延迟
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whistle.mock-plugins",
3
- "version": "1.0.6-beta.6",
3
+ "version": "1.0.6-beta.7",
4
4
  "description": "Whistle 插件,用于快速创建 API 模拟数据",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {