mock-get
↗️ Isomorphic light mock HTTP get request and return Promise, support both node and browser environment
Install
$ npm install --save mock-get
Usage
// ES6; // nodeconst get = ; ;
delay
milliseconds you want to delay your request, default value is0
mockData
json object will be resolve in the Promise (optional)hasError
default is false, set to true if you want the Promise to reject (optional)
Use second parameter as boolean to set hasError
if you do not have your own mock data.
Mock Request
;
will log the response data
Fire an Error
;
will log error message
Use your own mock data
;
; ;
Default Response
This is how default response look like, you can use your own mock data if you want.
License
MIT