micro_http: fix doctest socket conflicts

Doctests in `lib.rs` and `server.rs` were both using the same hardcoded
socket path `/tmp/example.sock`. When running tests in parallel, this
caused conflicts and sporadic failures with `AddrInUse`.

Fix this by using unique socket paths for each doctest.

Assisted-by: Antigravity:Gemini-3.5-Flash
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
This commit is contained in:
Changyuan Lyu
2026-07-13 14:25:02 -07:00
committed by Ilias Stamatis
parent f2d91703a1
commit 7975fe0e59
2 changed files with 2 additions and 2 deletions

View File

@@ -83,7 +83,7 @@
//! ```
//! use micro_http::{HttpServer, Response, StatusCode};
//!
//! let path_to_socket = "/tmp/example.sock";
//! let path_to_socket = "/tmp/example_lib.sock";
//! std::fs::remove_file(path_to_socket).unwrap_or_default();
//!
//! // Start the server.

View File

@@ -226,7 +226,7 @@ impl<T: Read + Write + ScmSocket> ClientConnection<T> {
/// ```
/// use micro_http::{HttpServer, Response, StatusCode};
///
/// let path_to_socket = "/tmp/example.sock";
/// let path_to_socket = "/tmp/example_server.sock";
/// std::fs::remove_file(path_to_socket).unwrap_or_default();
///
/// // Start the server.