Mocky is a browser extension that resolves outgoing client-initiated network requests with pre-determined responses recorded in .har
file. Below is a quick demo:
Primer: A HAR file contains a record of all data exchanged between client and server. The data is recorded in
<request, response>
pairs and segmented by pages
An intiated request is matched to request present in the .har
file based on following values:
- Request URL
- Request method (GET/POST/...)
- Request Post data (if present)
- Resource type of the response data (XHR/Fetch/Document)
Once a matching request is found in the provided file, the network request is resolved with response which is part of the same <request, response>
pair as the request
- Select the resource types to base request matching on
- Ignore hostname of the request (only match request on the path which proceeds the hostname)
- Chrome
- Firefox
- Opera (Chrome Build)
- Edge (Chrome Build)
- Brave
- Safari
Credit to Debdut Karmakar for extension template