You are building an Optic Middleware, that logs traffic in the ECS format (social proof) to the Optic CLI that is running during local development or in your Continuous Integration environment

With the middleware installed, all your test traffic can be observed by Optic even if doesn't go over the network, and you don't need to use api run <x> commands anymore, your normal commands will work just fine

Building a basic Optic Middleware for your framework

  1. Log the contents of every request / response to the console. This should take < 30 mins
  2. Transform that requests / response into ECS using one of the pre-built converts from Elastic < 20 mins.
  3. Send the traffic to Optic's local CLI

Making it user friendly:

tl;dr a logging middleware, built on the open source standard for logging traffic, that logs to Optic so it's easier for Optic to see your test traffic and learn about your API behavior.


Repo Setup

In your repo we expect to see:

Acceptance Criteria

  1. The repo structure should be a monorepo for the language in question split by the core language SDK and the separate frameworks that the middleware is built for
  1. The SDK should expose an interface that can receive a configuration object
    1. The configuration object should contain the following
      1. enabled a boolean to tell the library to capture and send HTTP traffic
      2. uploadUrl a string to allow pointing the captures to a custom URL, this should default to usingOPTIC_LOGGING_URL from an environment variable
      3. console a boolean to manage if the HTTP request is logged to stdout for debugging purposes
      4. framework a string additional language/framework information to inform Optic of where it is capturing information