Comments (6)
@IEfucker 你可能对代理有误解。
from mocker-api.
@jaywcjlove 啊,那我这样做不行喽?
from mocker-api.
@IEfucker 可以的,你可以运行下面这个例子。试一试。
mocker-api/example/webpack/mocker/index.js
Lines 9 to 14 in d86465e
from mocker-api.
抱歉我好像没有把我的问题表述清楚
我遇到一个问题,请求的接口用localhost(当然这个接口在本地也是通过代理,代理到真实地址)可以使用mock拦截,返回mock数据
但我使用真是接口 http://www.baidu.com/api/xxx/test 这种,为什么mock拦截不到
不知道是我配置错了,还是说mockapi只能用在localhost接口?
from mocker-api.
@IEfucker 你对代理可能有误解,你直接访问API http://www.baidu.com/api/xxx/test
浏览器直接访问百度API,没有走你本地服务,mocker-api
不是一个浏览器插件,它是你本地服务的中间件。
from mocker-api.
哦**了
谢谢解答
from mocker-api.
Related Issues (20)
- 更改mock文件,提示编译成功,但是浏览器报错404 HOT 2
- The MockerProxyRoute type does not work for strictNullChecks HOT 7
- Unable to use mocker-api in commonjs with type-checking enabled HOT 8
- Advice: add mocker api config like `mocker.config.js` HOT 14
- Advice: give a quick start by the `npx mocker-ap` after `npm install mocker-api` HOT 1
- 之前一直在用2.0.4版,之前配置了proxy, 如果有配置mocker的路径就走mock,没有就走代理的特性没有了 HOT 13
- [Advice] Add issue template HOT 5
- Types declaration files are not release package HOT 2
- does it support Mock grammar? HOT 5
- 升级 Webpack 5 实例与 typedoc 冲突报错 HOT 1
- Action Required: Fix Renovate Configuration HOT 1
- Feature: Add option for additional files/folders to be watched
- Feature: support for vite2.0 HOT 2
- add setupProxy to src, throw error: Cannot use import statement outside a module
- Dependency Dashboard
- Feature: 怎么统一给代理的请求添加前缀 HOT 3
- Bug: delay undefined HOT 3
- Feature: Response patching
- 怎么使用 application/json 类型的解析器 HOT 6
- Feature: 能否支持一下vite配置呢? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mocker-api.