Total Pageviews

Monday, 11 July 2022

Mocker

 HTTP/HTTPS mock tool, based on proxy server.

中文文档

HTTP/HTTPS mock tool, supports browsers and local server requests, can be used to mock response data returns and facilitate development and testing.
Based on Node.js and Electron.

Preview

image

Features

  • Intercepting and simulating response based on proxy server mechanism.
  • Normally no need to manually set proxy.
  • You can mock data without modifying the request link in your code, do not pollute the source code.
  • Mock data support requests from browsers and local servers.
  • Support HTTP and HTTPS requests, automatically generate local SSL certificates.
  • Fully custom response content.

🎁 Download

https://github.com/eshengsky/Mocker/releases

Note

  • Currently only support Windows platform.
  • Please make sure that your Windows has been installed PowerShell (Win7+ systems are usually installed by default).
  • Run Mocker as administrator as possible.

Quick Start

Firstly install Node.js and NPM.

install dependencies

$ npm install

lauch app

$ npm start

If you want to lauch the application in debug mode, use:

$ npm run dev

Enjoy it! 

How to package

You can use electron-packager to package the program to distribute the app.

install electron-packager

$ npm install -g electron-packager

package app

After complete Quick Start, go into the directory which app you want to package, execute:

$ npm run package

Note

In the packing process, electron-packager will automatically download the required files and store it in user/yourname/.electron, automatic downloading may be slow, it is recommended that use download tool to download the files in Electron Release then put in the above directory.

FAQ

  • How to mock https response?
    Click Mocker menu bar SSL - Download certificate..., save the SSL certificate to any location, then click SSL - Open certmgr, choose Trusted root certification authority - certificate, right click and choose all tasks - import, select the certificate you just downloaded, and the other options default, complete the import.

  • How to mock data sent by local servers (such as Node.js server)?
    Mocker is based on proxy servers, so you only need to set agent as http://127.0.0.1:28369 or https://127.0.0.1:28369. Take Node.js server as an example, use set HTTP_PROXY=http://127.0.0.1:28369&&node ./bin/www.

  • I can't get to the Internet after close Mocker.
    In normal circumstances, Mocker will automatically reset the system agent to empty before exiting the program, but in some special cases (such as manually killing process, direct shutdown, program exception, etc.), the system agent may not automatically reset, you need to manually set it, square: open the IE - Internet option - Connection - LAN settings, uncheck the proxy server.

  • I can't use it correctly, or did I have an unusual error.
    Try to run app as administrator, if still not working, please submit Issue.

    from https://github.com/eshengsky/Mocker

 

No comments:

Post a Comment