Skip to content

Commit

Permalink
test: add docstring test
Browse files Browse the repository at this point in the history
  • Loading branch information
tejmagar committed Jun 7, 2024
1 parent 6823e0e commit dc36d5c
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/core/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,27 @@ impl Server {
Ok(instance)
}

// Force provided scheme in all the requests
/// Force provided scheme in all the requests
///
/// # Examples
/// ```
/// use racoon::core::server::Server;
/// use racoon::core::request::Request;
/// use racoon::core::response::Response;
/// use racoon::core::server::RequestScheme;
///
///
/// async fn home(request: Request) -> Response {
/// let scheme = request.scheme;
/// assert_eq!(scheme, "https");
///
/// todo!()
/// }
///
/// let server = Server::bind("127.0.0.1::8080")
/// .set_scheme(RequestScheme::HTTPS);
///
/// ```
pub fn set_scheme(&mut self, scheme: RequestScheme) -> &mut Self {
match scheme {
RequestScheme::HTTP => {
Expand All @@ -174,7 +194,7 @@ impl Server {
self
}

// Enables logging for internal debug
/// Enables logging for internal debug
pub fn enable_logging() {
env::set_var("RACOON_LOGGING", "true");
}
Expand Down

0 comments on commit dc36d5c

Please sign in to comment.