spec: enable syntax highlighting for code snippets

This commit is contained in:
pancho horrillo
2019-05-29 10:05:32 +02:00
parent 0384d81b9f
commit 823974551d
+16 -16
View File
@@ -127,12 +127,12 @@ whole lifetime of the server.
deleted).
For instance, given this request:
```
```http
HTTP/1.1 GET /routes
```
an appropiate reponse may look like this:
```
```http
200 OK
Content-Type: application/json
Content-Length: 189
@@ -169,7 +169,7 @@ Returns JSON data about the current routes.
* **Success Responses**:
* **Code**: `200 OK`<br />
**Content**:<br />
```
```json
[
{
"method": "GET",
@@ -197,7 +197,7 @@ Accepts JSON data that defines a new route to be appended to the current routes.
* **Method**: `POST`
* **Header**: `Content-Type: application/json`
* **Data Params**:<br />
```
```json
{
"method": "GET",
"url_pattern": "/hello",
@@ -209,7 +209,7 @@ Accepts JSON data that defines a new route to be appended to the current routes.
* **Code**: `201 Created`<br />
**Header**: `Content-Type: application/json`<br />
**Content**:<br />
```
```json
{
"method": "GET",
"url_pattern": "/hello",
@@ -225,7 +225,7 @@ Accepts JSON data that defines a new route to be appended to the current routes.
* **Code**: `400 Missing Mandatory Field`<br />
**Header**: `Content-Type: application/json`<br />
**Content**:
```
```json
{
"missing_mandatory_fields": [
"url_pattern",
@@ -234,7 +234,7 @@ Accepts JSON data that defines a new route to be appended to the current routes.
}
```
* **Sample Call**:
```
```sh
$ curl -X POST --data-binary @- $KAPOW_URL/routes <<EOF
{
"method": "GET",
@@ -261,7 +261,7 @@ Accepts JSON data that defines a new route to be appended to the current routes.
* **Method**: `PUT`
* **Header**: `Content-Type: application/json`
* **Data Params**:<br />
```
```json
{
"method": "GET",
"url_pattern": "/hello",
@@ -273,7 +273,7 @@ Accepts JSON data that defines a new route to be appended to the current routes.
* **Code**: `200 OK`<br />
**Header**: `Content-Type: application/json`<br />
**Content**:<br />
```
```json
{
"method": "GET",
"url_pattern": "/hello",
@@ -289,7 +289,7 @@ Accepts JSON data that defines a new route to be appended to the current routes.
* **Code**: `400 Missing Mandatory Field`<br />
**Header**: `Content-Type: application/json`<br />
**Content**:
```
```json
{
"missing_mandatory_fields": [
"url_pattern",
@@ -302,7 +302,7 @@ Accepts JSON data that defines a new route to be appended to the current routes.
* **Code**: `404 Invalid Index`
* **Code**: `404 Invalid Route Spec`
* **Sample Call**:
```
```sh
$ curl -X PUT --data-binary @- $KAPOW_URL/routes <<EOF`
{
"method": "GET",
@@ -332,7 +332,7 @@ Removes the route identified by `:id`.
* **Success Responses**:
* **Code**: `200 OK`<br />
**Content**:
```
```json
{
"method": "GET",
"url_pattern": "/hello",
@@ -344,7 +344,7 @@ Removes the route identified by `:id`.
* **Error Responses**:
* **Code**: `404 Not Found`
* **Sample Call**:
```
```sh
$ curl -X DELETE $KAPOW_URL/routes/ROUTE_1f186c92_f906_4506_9788_a1f541b11d0f
```
* **Notes**:
@@ -442,7 +442,7 @@ following resource paths:
- Comment: That would provide read-only access to the value of the request header `Content-Type`.
- Read a field from a form.
- Scenario: A request generated by submitting this form:<br />
```
```html
<form method="post">
First name:<br>
<input type="text" name="firstname" value="Jane"><br>
@@ -490,7 +490,7 @@ Returns the value of the requested resource path, or an error if the resource pa
**Notes**: Check the list of valid resource paths at the top of this section.
* **Code**: `404 Not Found`
* **Sample Call**:
```
```sh
$ curl /handlers/$KAPOW_HANDLER_ID/request/body
```
* **Notes**: TODO
@@ -512,7 +512,7 @@ Returns the value of the requested resource path, or an error if the resource pa
* **Code**: `404 Name Not Found`<br />
**Notes**: Although the resource path is correct, no such name is present in the request. For instance, `/request/headers/Foo`, when no `Foo` header is not present in the request.
* **Sample Call**:
```
```sh
FIXME: python snippet instead?
$ curl -X PUT /handlers/$KAPOW_HANDLER_ID/response/body < /tmp/some_file
```