Add new Optic tasks and customize your Optic captures.
When you first setup Optic, a
start task is added to your
optic.yml file. The start task can be run using
name: Todo API tasks: start: command: npm run server-start baseUrl: 'http://localhost:3005'
You may also want a quick way to run your API tests, a Postman collection, etc through Optic. To make this simple, Optic lets you define as many custom tasks as you'd like:
name: Todo API tasks: start: command: npm run server-start baseUrl: 'http://localhost:3005' test: command: npm run testAPI baseUrl: 'http://localhost:3005'
Each custom task is run with
api run <task name> ie
api run test
Ignoring API Paths
As you use Optic, you will probably realize there are some paths you'd like Optic to ignore. Examples include
.css files, or everything in your
/public * folder.
You an add ignore rules to your
name: Todo API tasks: start: command: npm run server-start baseUrl: 'http://localhost:3005' ignoreRequests: - OPTIONS * # Ignores all options requests - GET /public/**
Rules are formatted like this:
You can add a list of methods ie
GET POST PUT, use a single method ie
GET and if you do not specify a method Optic will match them all.