Skip to main content

Mocking API

AKA Mockingbird - A simple mocking API

Overview

Mockingbird allows you to upload captured web session traffic, (captured from your browser as a HAR file) and turn the session traffic into a API.

prerequisites

Mockingbird is a separate repository due to the size if HAR files. You can view the repo here: https://gitlab.com/investec/digital/web/cloudflare/io-mockingbird/

Capturing web session traffic

When you follow a user journey on a website, your browser stores all requests and responses and can be exported

  1. Right-click in the browser window or tab and select Inspect

  2. Click the Network tab in the panel that appears

  3. Navigate to the URL you want to traffic

  4. Click the download button Download (Export HAR appears when you hold the pointer over it)

  5. Name the file appropriately (e.g. private-client-make-a-payment.har), the file name will be your key to access your mock api

  6. Click Save

Deploying mocks

  1. Add your mock to ./mocks directory

  2. run node tools/process-har.js to test your HAR can be parsed

  3. Commit and create a merge request

  4. Watch the pipeline to make sure it deploys

Mock API requests

  1. Set a header {store: 'YOUR_KEY_HERE'}, this header is used to target your mock

  2. Make a request to platform.investec.com/proxy/*