update the example to show off multiple-responses
This commit is contained in:
parent
71142b08d4
commit
07472ccb7a
2 changed files with 32 additions and 12 deletions
|
@ -39,6 +39,11 @@ instance ToParam (QueryParam "capital" Bool) where
|
|||
instance ToSample Greet where
|
||||
toSample = Just $ Greet "Hello, haskeller!"
|
||||
|
||||
toSamples =
|
||||
[ ("If you use ?capital=true", Greet "HELLO, HASKELLER")
|
||||
, ("If you use ?capital=false", Greet "Hello, haskeller")
|
||||
]
|
||||
|
||||
-- API specification
|
||||
type TestApi =
|
||||
-- GET /hello/:name?capital={true, false} returns a Greet as JSON
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
POST /greet
|
||||
-----------
|
||||
|
||||
|
@ -13,11 +12,19 @@ POST /greet
|
|||
**Response**:
|
||||
|
||||
- Status code 201
|
||||
- Response body as below.
|
||||
- If you use ?capital=true
|
||||
|
||||
``` javascript
|
||||
{
|
||||
"msg": "Hello, haskeller!"
|
||||
"msg": "HELLO, HASKELLER"
|
||||
}
|
||||
```
|
||||
|
||||
- If you use ?capital=false
|
||||
|
||||
``` javascript
|
||||
{
|
||||
"msg": "Hello, haskeller"
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -38,11 +45,19 @@ GET /hello/:name
|
|||
**Response**:
|
||||
|
||||
- Status code 200
|
||||
- Response body as below.
|
||||
- If you use ?capital=true
|
||||
|
||||
``` javascript
|
||||
{
|
||||
"msg": "Hello, haskeller!"
|
||||
"msg": "HELLO, HASKELLER"
|
||||
}
|
||||
```
|
||||
|
||||
- If you use ?capital=false
|
||||
|
||||
``` javascript
|
||||
{
|
||||
"msg": "Hello, haskeller"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue