Skip to content

Commit 9d706af

Browse files
committed
refactor: move theory to reference section
1 parent 3ffe29b commit 9d706af

2 files changed

Lines changed: 28 additions & 27 deletions

File tree

docs/04-more-examples.md

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,12 @@ hide_title: true
1010

1111
:::
1212

13-
This page describes some key concepts before you use **chkware**. There are two parts to this tool.
1413

15-
1. The command line tool that you can run as `chk`
16-
2. The test specification files: those you write in YAML, in supported DSL.
17-
18-
### Test specifications
19-
20-
Test specification files are written in YAML. So, before you start writing any specs, you should have a proper introduction to YAML, if you do not have already. Here is a fine [YAML cheatsheet](https://quickref.me/yaml) to grasp some knowledge.
21-
22-
> In the future evolution path of **chkware** we are going to introduce more and more specification options and specification types and versions.
23-
24-
Let’s first get you introduced to the (till now) only specification format supported by **chkware**, the Http specification format. As mentioned in the introduction page **_Create reusable offline http request specification._**, the Http specification format is how you express a Http request format. Following are some examples by case to write Http specification file.
25-
26-
---
27-
28-
### Examples
14+
## Examples
2915

3016
Following are the examples with HTTP GET method. Although all these example are still valid for POST, PUT, PATCH, DELETE, OPTIONS, HEAD method as well.
3117

32-
#### Minimal request
18+
### Minimal request
3319

3420
```yaml
3521
---
@@ -38,7 +24,7 @@ request:
3824
method: GET
3925
```
4026
41-
#### Request with query string
27+
### Request with query string
4228
4329
```yaml
4430
---
@@ -61,7 +47,7 @@ request:
6147
two: 2
6248
```
6349
64-
#### Request with query string and header
50+
### Request with query string and header
6551
6652
```yaml
6753
---
@@ -78,7 +64,7 @@ request:
7864
Accept-Encoding: gzip, deflate
7965
```
8066
81-
#### Request with basic authentication header
67+
### Request with basic authentication header
8268
8369
```yaml
8470
---
@@ -97,7 +83,7 @@ request:
9783
9884
`username` and `password` will be automatically transformed to secret string as per [Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#basic_authentication_scheme) scheme.
9985

100-
#### Request with bearer authentication header
86+
### Request with bearer authentication header
10187

10288
```yaml
10389
---
@@ -113,7 +99,7 @@ request:
11399
token: eyJhbGciOiJIU...4fwpMeJf36POk6yJV_adQssw5c
114100
```
115101

116-
#### Request without a body
102+
### Request without a body
117103

118104
```yaml
119105
---
@@ -131,7 +117,7 @@ request:
131117
body[none]: ~
132118
```
133119

134-
#### Request with JSON body
120+
### Request with JSON body
135121

136122
```yaml
137123
---
@@ -149,7 +135,7 @@ request:
149135
body[json]: { user_id: 32, roll_no: 1, class: 2, name: 'Student name' }
150136
```
151137

152-
#### Request with form
138+
### Request with form
153139

154140
Following example will submit a plain html form POST with encoding type `application/x-www-form-urlencoded`
155141

@@ -174,7 +160,7 @@ request:
174160
photo: file:///home/username/student-photo-01.png # note: this will just pass filepath as string, not the actual file
175161
```
176162

177-
#### Request with file upload
163+
### Request with file upload
178164

179165
Following example will submit a plain html form POST with encoding type `multipart/form-data`
180166

@@ -200,7 +186,7 @@ request:
200186
cover_photo: file:///home/username/student-cvphoto-01.png
201187
```
202188

203-
#### Request with XML in body
189+
### Request with XML in body
204190

205191
Following example will submit a plain html form POST with encoding type `multipart/form-data`
206192

docs/05-reference.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,23 @@ hide_title: true
1010

1111
:::
1212

13-
All `.chk` file is a valid YAML file. We are using this specific extension so these files do not make you
14-
confuse in typical project layout.
13+
This page describes some key concepts before you use **chkware**. There are two parts to this tool.
14+
15+
1. The command line tool that you can run as `chk http`
16+
2. The test specification files: those you write in YAML, have extension `.chk`.
17+
18+
### Test specifications
19+
20+
Test specification files are written in YAML, having file extension `.chk`. So, before you start writing any
21+
specs, you should have a proper introduction to YAML, if you do not have already. Here is a fine
22+
[YAML cheatsheet](https://quickref.me/yaml) to grasp some knowledge.We are using this specific extension (`.chk`) so these files do not
23+
make you confuse in typical project layout.
24+
25+
> In the future evolution path of **chkware** we are going to introduce more and more specification options and specification types and versions.
26+
27+
Let’s first get you introduced to the (till now) only specification format supported by **chkware**, the Http specification format. As mentioned in the introduction page **_Create reusable offline http request specification._**, the Http specification format is how you express a Http request format. Following are some examples by case to write Http specification file.
28+
29+
---
1530

1631
Following yaml blocks can be used to identify different section of a Http specification file.
1732

0 commit comments

Comments
 (0)