Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR removes sample images from static assets and replaces them with a proper static file serving infrastructure. The changes introduce HTML file serving capabilities and comprehensive test coverage for static file functionality.
- Removes sample PNG/JPG files and adds
index.htmlstatic file serving - Refactors integration tests to use simpler server lifecycle management
- Adds dedicated static file test coverage with proper HTML content verification
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/static_files_test.rs | New test file for static file serving functionality |
| src/test/mod.rs | Registers the new static files test module |
| src/test/integration_test.rs | Simplifies server management and adds static file integration test |
| src/server.rs | Integrates static file serving and moves error handling to top level |
| src/router.rs | Updates error handling to use Rejection instead of Infallible |
| src/controllers/mod.rs | Updates return type to use Rejection for proper error propagation |
| src/config.rs | Adds static_dir configuration field |
| public/index.html | New HTML file for static serving tests |
| README.md | Documents new static file serving feature |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| .and(warp::get()) | ||
| .and_then(|| async { | ||
| Ok::<_, Rejection>(warp::reply::json(&swagger::ApiDoc::openapi())) | ||
| }); |
There was a problem hiding this comment.
The closure should be simplified to use warp::reply::json directly without the unnecessary async block and Result wrapping.
| }); | |
| .map(|| warp::reply::json(&swagger::ApiDoc::openapi())); |
| let response = client.get(address).send().await.unwrap(); | ||
| assert_eq!(response.status(), 200); | ||
| let body = response.text().await.unwrap(); | ||
| assert!(body.contains("Static file served")); |
There was a problem hiding this comment.
[nitpick] This assertion duplicates the same check in static_files_test.rs. Consider extracting this into a shared test helper or constant to avoid duplication.
| assert!(body.contains("Static file served")); | |
| assert!(body.contains(STATIC_FILE_SERVED_TEXT)); |
Summary
index.htmlTesting
SWAGGER_UI_DOWNLOAD_URL=file://$(pwd)/swagger-ui.zip cargo test(fails: invalid zip header)https://chatgpt.com/codex/tasks/task_e_68a15462425883209ee6af91b9702e42