Skip to content

Commit a22df5e

Browse files
committed
use jsonc in code blocks
Signed-off-by: Adam Ludes <adam.ludes@whalebone.io>
1 parent 2466739 commit a22df5e

File tree

1 file changed

+42
-32
lines changed

1 file changed

+42
-32
lines changed

README.md

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,37 @@ Killgrave is a simulator for HTTP-based APIs, in simple words a **Mock Server**,
1212
[![FriendsOfGo](https://img.shields.io/badge/powered%20by-Friends%20of%20Go-73D7E2.svg)](https://friendsofgo.tech)
1313

1414
# Table of Content
15-
- [Overview](#overview)
16-
- [Concepts](#concepts)
17-
* [Imposters](#imposters)
18-
- [Installing](#installing)
19-
* [Homebrew](#homebrew)
20-
* [Docker](#docker)
21-
* [Compile by yourself](#compile-by-yourself)
22-
* [Other](#other)
23-
- [Getting Started](#getting-started)
24-
* [Using Killgrave by command line](#using-killgrave-from-the-command-line)
25-
* [Using Killgrave by config file](#using-killgrave-by-config-file)
26-
* [Configure CORS](#configure-cors)
27-
* [Preparing Killgrave for Proxy Mode](#preparing-killgrave-for-proxy-mode)
28-
* [Creating an Imposter](#creating-an-imposter)
29-
* [Imposters structure](#imposters-structure)
30-
* [Using regex in imposters](#using-regex-in-imposters)
31-
* [Creating an imposter using JSON Schema](#creating-an-imposter-using-json-schema)
32-
* [Creating an imposter with delay](#creating-an-imposter-with-delay)
33-
* [Creating an imposter with dynamic responses](#creating-an-imposter-with-dynamic-responses)
34-
- [Contributing](#contributing)
35-
- [License](#license)
15+
- [Killgrave](#killgrave)
16+
- [Table of Content](#table-of-content)
17+
- [Overview](#overview)
18+
- [Concepts](#concepts)
19+
- [Imposters](#imposters)
20+
- [Installing](#installing)
21+
- [Homebrew](#homebrew)
22+
- [Docker](#docker)
23+
- [Compile by yourself](#compile-by-yourself)
24+
- [Other](#other)
25+
- [Getting Started](#getting-started)
26+
- [Using Killgrave from the command line](#using-killgrave-from-the-command-line)
27+
- [Using Killgrave by config file](#using-killgrave-by-config-file)
28+
- [How to use](#how-to-use)
29+
- [Configure CORS](#configure-cors)
30+
- [Preparing Killgrave for Proxy Mode](#preparing-killgrave-for-proxy-mode)
31+
- [Creating an Imposter](#creating-an-imposter)
32+
- [Imposters Structure](#imposters-structure)
33+
- [Request](#request)
34+
- [Response](#response)
35+
- [Using regex in imposters](#using-regex-in-imposters)
36+
- [Regex in the endpoint](#regex-in-the-endpoint)
37+
- [Regex in the query parameters:](#regex-in-the-query-parameters)
38+
- [Regex in the headers:](#regex-in-the-headers)
39+
- [Creating an imposter using JSON Schema](#creating-an-imposter-using-json-schema)
40+
- [Creating an imposter with delay](#creating-an-imposter-with-delay)
41+
- [Creating an imposter with dynamic responses](#creating-an-imposter-with-dynamic-responses)
42+
- [Using Templating in Responses](#using-templating-in-responses)
43+
- [Available custom templating functions](#available-custom-templating-functions)
44+
- [Contributing](#contributing)
45+
- [License](#license)
3646

3747
## Overview
3848

@@ -71,7 +81,7 @@ You can learn more about how to configure imposters in the [Imposter Configurati
7181
7282
You can install Killgrave in different ways, but all of them are very simple:
7383

74-
### Homebrew
84+
### Homebrew
7585

7686
If you are a Mac user, you can install Killgrave using [Homebrew](https://brew.sh/):
7787

@@ -219,29 +229,29 @@ If you want to use `killgrave` from a client application you should consider con
219229
In the CORS section of the file you can find the following options:
220230
221231
- **methods** (string array)
222-
232+
223233
Represents the **Access-Control-Request-Method header**, if you don't specify it or if you leave it as an empty array, the default values will be:
224234
225235
`"GET", "HEAD", "POST", "PUT", "OPTIONS", "DELETE", "PATCH", "TRACE", "CONNECT"`
226236
227237
- **headers** (string array)
228-
238+
229239
Represents the **Access-Control-Request-Headers header**, if you don't specify it or if you leave it as an empty array, the default values will be:
230240
231241
`"X-Requested-With", "Content-Type", "Authorization"`
232242
233243
- **exposed_headers** (string array)
234-
244+
235245
Represents the **Access-Control-Expose-Headers header**, if you don't specify it or if you leave it as an empty array, the default values will be:
236246
237247
`"Cache-Control", "Content-Language", "Content-Type", "Expires", "Last-Modified", "Pragma"`
238248
239249
- **origins** (string array)
240-
250+
241251
Represents the **Access-Control-Allow-Origin header**, if you don't specify it or if you leave it as an empty array this option has not default value
242252
243253
- **allow_credentials** (boolean)
244-
254+
245255
Enables or disables the **Access-Control-Allow-Credentials header**.
246256
247257
### Preparing Killgrave for Proxy Mode
@@ -264,7 +274,7 @@ We use a rule-based system to match requests to imposters. Therefore, you have t
264274
{
265275
"request": {
266276
"method": "GET",
267-
"endpoint": "/gophers/01D8EMQ185CA8PRGE20DKZTGSR"
277+
"endpoint": "/gophers/01D8EMQ185CA8PRGE20DKZTGSR"
268278
},
269279
"response": {
270280
"status": 200,
@@ -592,7 +602,7 @@ Since query parameters can be used more than once, they are stored in an array a
592602

593603
Here is an example that includes query parameters gopherColor and gopherAge in the response, one of which can be used more than once:
594604

595-
````json
605+
````jsonc
596606
// expects a request to, for example, GET /gophers/bca49e8a-82dd-4c5d-b886-13a6ceb3744b?gopherColor=Blue&gopherColor=Purple&gopherAge=42
597607
[
598608
{
@@ -621,7 +631,7 @@ This example also showcases the functions `timeNow`, `timeUTC`, `timeAdd`, `time
621631

622632
Here is an example that includes the request body in the response:
623633

624-
````json
634+
````jsonc
625635
// imposters/gophers.imp.json
626636
[
627637
{
@@ -647,7 +657,7 @@ Here is an example that includes the request body in the response:
647657
}
648658
]
649659
````
650-
````tmpl
660+
````jsonc
651661
// responses/create_gopher_response.json.tmpl
652662
{
653663
"data": {
@@ -665,7 +675,7 @@ Here is an example that includes the request body in the response:
665675
}
666676

667677
````
668-
````json
678+
````jsonc
669679
// request body to POST /gophers/bca49e8a-82dd-4c5d-b886-13a6ceb3744b?gopherColor=Blue&gopherColor=Purple&gopherAge=42
670680
{
671681
"data": {

0 commit comments

Comments
 (0)