|
| 1 | +--- |
| 2 | +title: Reference |
| 3 | +hide_title: true |
| 4 | +--- |
| 5 | + |
| 6 | +:::note |
| 7 | + |
| 8 | +- This page should be use as reference for specification files. |
| 9 | +- This page is subject to change. It is requested to check this page frequently. |
| 10 | + |
| 11 | +::: |
| 12 | + |
| 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. |
| 15 | + |
| 16 | +Following yaml blocks can be used to identify different section of a Http specification file. |
| 17 | + |
| 18 | +```yaml |
| 19 | +--- |
| 20 | +request: |
| 21 | + # valid URL |
| 22 | + url: https://httpbin.org/get |
| 23 | + |
| 24 | + # for query string or url parameters |
| 25 | + url_params: |
| 26 | + one: 1 |
| 27 | + two: true |
| 28 | + |
| 29 | + # http method to use |
| 30 | + method: GET # or POST, PUT, PATCH, DELETE, OPTIONS, HEAD |
| 31 | + |
| 32 | + # send requst headers |
| 33 | + # add any numbers of headers |
| 34 | + # Causion: some values or keys need to be wrapped with single (') or double (") quote |
| 35 | + headers: |
| 36 | + User-Agent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36' |
| 37 | + 'Accept-Encoding': 'gzip, deflate' |
| 38 | + accept: '*/*' |
| 39 | + |
| 40 | + # send authentication header. |
| 41 | + # two supported type: auth[bearer], auth[basic]: |
| 42 | + |
| 43 | + # auth[bearer] example |
| 44 | + auth[bearer]: |
| 45 | + token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c |
| 46 | + |
| 47 | + # auth[basic] example |
| 48 | + auth[basic]: |
| 49 | + username: Some_USER |
| 50 | + password: 'Some-P@$$W03D' |
| 51 | + |
| 52 | + # send request body with the request |
| 53 | + |
| 54 | + # no body to send |
| 55 | + body[none]: ~ |
| 56 | + |
| 57 | + # to send application/x-www-form-urlencoded form enctype |
| 58 | + body[form]: |
| 59 | + 'var 1': 'var str 1' |
| 60 | + var-2: 'var str 2' |
| 61 | + # note: this will just pass filepath as value |
| 62 | + var_3: file:///home/username/.vimrc |
| 63 | + |
| 64 | + # to upload file as part of body use multipart/form-data like |
| 65 | + body[form-data]: |
| 66 | + 'var 1': 'var str 1' |
| 67 | + var-2: 'var str 2' |
| 68 | + # note this will actually upload a file |
| 69 | + # we use file protocol (file://) scheme to identify a file |
| 70 | + var_3: file:///home/username/.vimrc |
| 71 | + var4: file:///home/username/Documents/CID-25601.IpPhone.rtf |
| 72 | + |
| 73 | + # to send plain text |
| 74 | + body[text]: 'Plain text here' |
| 75 | + |
| 76 | + # to pass as json to body pass a yaml object like |
| 77 | + body[json]: { user_id: 32, roll_no: 1, class: 2, name: 'Student name' } |
| 78 | + |
| 79 | + # to pass a xml as body use a yaml literal block |
| 80 | + body[xml]: | |
| 81 | + <?xml version="1.0"?> |
| 82 | + <catalog> |
| 83 | + <book id="bk101"> |
| 84 | + <author>Gambardella, Matthew</author> |
| 85 | + <title>XML Developer's Guide</title> |
| 86 | + <genre>Computer</genre> |
| 87 | + <price>44.95</price> |
| 88 | + <publish_date>2000-10-01</publish_date> |
| 89 | + <description>An in-depth look at creating applications |
| 90 | + with XML.</description> |
| 91 | + </book> |
| 92 | + <book id="bk102"> |
| 93 | + <author>Ralls, Kim</author> |
| 94 | + <title>Midnight Rain</title> |
| 95 | + <genre>Fantasy</genre> |
| 96 | + <price>5.95</price> |
| 97 | + <publish_date>2000-12-16</publish_date> |
| 98 | + <description>A former architect battles corporate zombies, |
| 99 | + an evil sorceress, and her own childhood to become queen |
| 100 | + of the world.</description> |
| 101 | + </book> |
| 102 | + </catalog> |
| 103 | +``` |
0 commit comments