UNPKG

mappersmith

Version:

It is a lightweight rest client for node.js and the browser

37 lines (28 loc) 548 B
import { Gateway } from './gateway' import { lookupResponseAsync } from '../test/index' export class Mock extends Gateway { get() { this.callMock() } head() { this.callMock() } post() { this.callMock() } put() { this.callMock() } patch() { this.callMock() } delete() { this.callMock() } callMock() { return lookupResponseAsync(this.request) .then((response) => this.dispatchResponse(response)) .catch((e) => this.dispatchClientError(e.message, e)) } } export default Mock