Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/cookbook/custom-errors/CustomErrors.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Now if we try to request something with a wrong body, we will get a nice error:
```
$ http -j POST localhost:8000/greet 'foo=bar'
HTTP/1.1 400 Bad Request
Content-Type: application/json;charset=utf-8
Content-Type: application/json
Date: Fri, 17 Jul 2020 13:34:18 GMT
Server: Warp/3.3.12
Transfer-Encoding: chunked
Expand Down
2 changes: 1 addition & 1 deletion doc/cookbook/file-upload/FileUpload.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ examples.

[...]

Response {responseStatus = Status {statusCode = 200, statusMessage = "OK"}, responseVersion = HTTP/1.1, responseHeaders = [("Transfer-Encoding","chunked"),("Date","Fri, 08 Dec 2017 16:50:14 GMT"),("Server","Warp/3.2.13"),("Content-Type","application/json;charset=utf-8")], responseBody = "0", responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}
Response {responseStatus = Status {statusCode = 200, statusMessage = "OK"}, responseVersion = HTTP/1.1, responseHeaders = [("Transfer-Encoding","chunked"),("Date","Fri, 08 Dec 2017 16:50:14 GMT"),("Server","Warp/3.2.13"),("Content-Type","application/json")], responseBody = "0", responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}
```

As usual, the code for this recipe is available in a cabal project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ $ curl -v -XPOST 'http://localhost:3001/login' \
< HTTP/1.1 200 OK
...
< Server: Warp/3.2.25
< Content-Type: application/json;charset=utf-8
< Content-Type: application/json
< Set-Cookie: JWT-Cookie=eyJhbGciOiJIUzUxMiJ9.eyJkYXQiOnsibmFtZSI6ImFkbWluIn19.SIoRcABKSO4mXnRifzqPWlHJUhVwuy32Qon7s1E_c3vHOsLXdXyX4V4eXOw9tMFoeIqgsXMZucqoFb36vAdKwQ; Path=/; HttpOnly; SameSite=Lax
< Set-Cookie: XSRF-TOKEN=y5PmrYHX3ywFUCwGRQqHh1TDheTLiQpwRQB3FFRd8N4=; Path=/
...
Expand Down
6 changes: 3 additions & 3 deletions doc/cookbook/multiverb/MultiVerb.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Now let us run the server and observe how it behaves:
```
$ http http://localhost:5000/version
HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
Content-Type: application/json
Date: Thu, 29 Aug 2024 14:22:20 GMT
Server: Warp/3.4.1
Transfer-Encoding: chunked
Expand All @@ -176,7 +176,7 @@ Transfer-Encoding: chunked
```
$ http http://localhost:5000/choices/3
HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
Content-Type: application/json
Date: Thu, 29 Aug 2024 14:22:30 GMT
Server: Warp/3.4.1
Transfer-Encoding: chunked
Expand All @@ -187,7 +187,7 @@ true
```
$ http http://localhost:5000/choices/2
HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
Content-Type: application/json
Date: Thu, 29 Aug 2024 14:22:33 GMT
Server: Warp/3.4.1
Transfer-Encoding: chunked
Expand Down
2 changes: 1 addition & 1 deletion doc/cookbook/openapi3/OpenAPI.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ The generated schema looks something like this:
"responses": {
"200": {
"content": {
"application/json;charset=utf-8": {
"application/json": {
"schema": {
"items": {
"$ref": "#/components/schemas/Todo"
Expand Down
2 changes: 1 addition & 1 deletion doc/cookbook/testing/Testing.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ Let's see what happens when we run these tests:
Headers: "Transfer-Encoding": "chunked"
"Date": "Fri, 12 Oct 2018 04:36:22 GMT"
"Server": "Warp/3.2.25"
"Content-Type": "application/json;charset=utf-8"
"Content-Type": "application/json"
Body: ""

To rerun use: --match "/Main[339:25]/API demonstrates best practices/"
Expand Down
4 changes: 2 additions & 2 deletions doc/cookbook/using-free-client/UsingFreeClient.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Making request: Request {
host = "localhost"
port = 8000
secure = False
requestHeaders = [("Accept","application/json;charset=utf-8,application/json")]
requestHeaders = [("Accept","application/json")]
path = "/square/42"
queryString = ""
method = "GET"
Expand All @@ -181,7 +181,7 @@ Got response: Response
[ ("Transfer-Encoding","chunked")
, ("Date","Thu, 05 Jul 2018 21:12:41 GMT")
, ("Server","Warp/3.2.22")
, ("Content-Type","application/json;charset=utf-8")
, ("Content-Type","application/json")
]
, responseBody = "1764"
, responseCookieJar = CJ {expose = []}
Expand Down
18 changes: 7 additions & 11 deletions doc/tutorial/Docs.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,16 @@ That lets us see what our API docs look like in markdown, by looking at `markdow

- Supported content types are:

- `application/json;charset=utf-8`
- `application/json`
- `application/json`

- When a value is provided for 'name' (`application/json;charset=utf-8`, `application/json`):
- When a value is provided for 'name' (`application/json`):

```json
{"msg":"Hello, Alp"}
```

- When 'name' is not specified (`application/json;charset=utf-8`, `application/json`):
- When 'name' is not specified (`application/json`):

```json
{"msg":"Hello, anonymous coward"}
Expand All @@ -148,10 +148,9 @@ That lets us see what our API docs look like in markdown, by looking at `markdow

- Supported content types are:

- `application/json;charset=utf-8`
- `application/json`

- Example (`application/json;charset=utf-8`, `application/json`):
- Example (`application/json`):

```json
{"clientAge":26,"clientEmail":"alp@foo.com","clientName":"Alp","clientInterestedIn":["haskell","mathematics"]}
Expand All @@ -164,10 +163,9 @@ That lets us see what our API docs look like in markdown, by looking at `markdow

- Supported content types are:

- `application/json;charset=utf-8`
- `application/json`

- Example (`application/json;charset=utf-8`, `application/json`):
- Example (`application/json`):

```json
{"subject":"Hey Alp, we miss you!","body":"Hi Alp,\n\nSince you've recently turned 26, have you checked out our latest haskell, mathematics products? Give us a visit!","to":"alp@foo.com","from":"great@company.com"}
Expand All @@ -187,10 +185,9 @@ That lets us see what our API docs look like in markdown, by looking at `markdow

- Supported content types are:

- `application/json;charset=utf-8`
- `application/json`

- Example (`application/json;charset=utf-8`, `application/json`):
- Example (`application/json`):

```json
{"yCoord":14,"xCoord":3}
Expand Down Expand Up @@ -236,11 +233,10 @@ The relevant output of `markdown api2Docs` is now:

- Supported content types are:

- `application/json;charset=utf-8`
- `application/json`
- `application/x-www-form-urlencoded`

- Example (`application/json;charset=utf-8`, `application/json`):
- Example (`application/json`):

```json
{"clientAge":26,"clientEmail":"alp@foo.com","clientName":"Alp","clientInterestedIn":["haskell","mathematics"]}
Expand Down
20 changes: 8 additions & 12 deletions servant-docs/example/greet.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ You'll also note that multiple intros are possible.

- Supported content types are:

- `application/json;charset=utf-8`
- `application/json`

- If you use ?capital=true (`application/json;charset=utf-8`, `application/json`):
- If you use ?capital=true (`application/json`):

```json
"HELLO, HASKELLER"
```

- If you use ?capital=false (`application/json;charset=utf-8`, `application/json`):
- If you use ?capital=false (`application/json`):

```json
"Hello, haskeller"
Expand All @@ -36,16 +35,15 @@ You'll also note that multiple intros are possible.

- Supported content types are:

- `application/json;charset=utf-8`
- `application/json`

- If you use ?capital=true (`application/json;charset=utf-8`, `application/json`):
- If you use ?capital=true (`application/json`):

```json
"HELLO, HASKELLER"
```

- If you use ?capital=false (`application/json;charset=utf-8`, `application/json`):
- If you use ?capital=false (`application/json`):

```json
"Hello, haskeller"
Expand All @@ -55,7 +53,7 @@ You'll also note that multiple intros are possible.

```bash
curl -XPOST \
-H "Content-Type: application/json;charset=utf-8" \
-H "Content-Type: application/json" \
-d "\"HELLO, HASKELLER\"" \
http://localhost:80/greet
```
Expand Down Expand Up @@ -85,10 +83,9 @@ And some more

- Supported content types are:

- `application/json;charset=utf-8`
- `application/json`

- Example (`application/json;charset=utf-8`, `application/json`):
- Example (`application/json`):

```json

Expand Down Expand Up @@ -126,17 +123,16 @@ curl -XDELETE \

- Supported content types are:

- `application/json;charset=utf-8`
- `application/json`
- `text/plain;charset=utf-8`

- If you use ?capital=true (`application/json;charset=utf-8`, `application/json`, `text/plain;charset=utf-8`):
- If you use ?capital=true (`application/json`, `text/plain;charset=utf-8`):

```json
"HELLO, HASKELLER"
```

- If you use ?capital=false (`application/json;charset=utf-8`, `application/json`):
- If you use ?capital=false (`application/json`):

```json
"Hello, haskeller"
Expand Down
Loading
Loading