Improve the documentation and bug fixes #3
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"method": "PUT",
|
||||
"path": "/api/testing",
|
||||
"host": "localhost:8180",
|
||||
"headers": {
|
||||
"accept": "*/*",
|
||||
"content-length": "18",
|
||||
"content-type": "application/json",
|
||||
"host": "localhost:8180",
|
||||
"user-agent": "curl/7.68.0"
|
||||
},
|
||||
"body": {
|
||||
"hello": "world"
|
||||
}
|
||||
}
|
19
src/main.rs
19
src/main.rs
|
@ -49,11 +49,26 @@ struct EchoResponse {
|
|||
///
|
||||
/// Captures the request and responds with a JSON response of the elements of the request.
|
||||
///
|
||||
/// TODO: Add a example of the JSON output of the response.
|
||||
///
|
||||
/// ## Arguments
|
||||
/// * `method` - The HTTP [`Method`] used for the request. i.e. `GET`, `POST`, `PATCH`, etc.
|
||||
/// TODO: Document the rest of the arguments
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
/// Sending a request using `curl`:
|
||||
///
|
||||
/// ```console
|
||||
/// $ curl -s -X PUT -D '{"hello": "world"}' -H 'Content-Type: application/json' \
|
||||
/// http://localhost:8080/api/testing | jq .
|
||||
/// ```
|
||||
///
|
||||
/// Results in a JSON response:
|
||||
///
|
||||
/// ```json
|
||||
#[doc = include_str!("../examples/sample-response.json")]
|
||||
/// ```
|
||||
///
|
||||
|
||||
async fn echo_request(
|
||||
method: Method,
|
||||
original_uri: OriginalUri,
|
||||
|
|
Loading…
Reference in New Issue