Improve the documentation and bug fixes #3

Merged
dorian merged 13 commits from improve-docs into main 2024-02-24 20:41:15 -05:00
2 changed files with 32 additions and 2 deletions
Showing only changes of commit f14963a2c4 - Show all commits

View File

@ -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"
}
}

View File

@ -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,