GuidesAPI Reference
API Reference

mockRequest(request: Request)

Mock an http request.

See Request for the request object structure.

import Mimic from 'mimic';

Mimic.mockRequest({
  method: 'get',
  url: 'http://example.com',
  params: { userId: 5 },
  headers: { 'Authorization': 'Basic token' },
  response: {
    status: 200,
    delay: 0,
    headers: { 'Content-Type': 'application/json' },
    body: '{ text: "hello world" }'
  }
});