Comments (3)
Why Polyfill? I think that this would work if it's loaded before Angular (or whatever library):
http://stackoverflow.com/questions/629671/how-can-i-intercept-xmlhttprequests-from-a-greasemonkey-script
from mimic.
Because we need to modify the response, we don't need to polyfill the entire API, just the parts we need.
@ilyagelman is currently investigating this
from mimic.
So I found this package: https://github.com/jpillora/xhook
xhook.before((request) => {
if (request.url.match('/users')) {
return { status: 200, data: { a: 1 } }
}
});
It also has can be easily disabled with xhook.disable()
It does not support fetch() though, but we can use it for v1 just to make things up and running.
from mimic.
Related Issues (20)
- Apply mocks once they are loaded HOT 4
- Dynamic import semiworking with import('mimic'); but working with require('mimic');. HOT 2
- getMatchingMock returns disabled mocks
- add support for sandbox / Iframes
- Keep mimic open on refresh HOT 2
- Set stopwatch to zero HOT 4
- Remote server black screen HOT 2
- Add virtualization to log
- Add reload & record button
- npm install issue HOT 1
- Match dynamic query parameters like dates HOT 1
- Import from postman collection HOT 2
- Added button to clean logs HOT 2
- When duplicating a mock, editing changes the original mock HOT 3
- Use secure connection: http => https
- Set default Content-Type to plain-text if it is not provided in response or request
- Request / Response body JSON validation
- Disable other scenarios
- Error response doesn't work with Angular HOT 3
- Does this support regular expression of request URL ?
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 mimic.