-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor path params and optimize JSON handling #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
64c63a9
00fee2d
5d574ce
b14f29c
5274871
ffee532
255d956
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -55,6 +55,7 @@ | |||||
| //! in any order. | ||||||
|
|
||||||
| use crate::error::{ApiError, Result}; | ||||||
| use crate::json; | ||||||
|
||||||
| use crate::json; |
Outdated
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function json::from_slice is called but the json module doesn't exist. This will cause a compilation error.
Outdated
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function json::to_vec_with_capacity is called but the json module doesn't exist. This will cause a compilation error.
Outdated
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function json::from_slice is called but the json module doesn't exist. This will cause a compilation error.
Tuntii marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type PathParams doesn't exist. Based on the code in request.rs, path parameters are still stored as HashMap<String, String>, not PathParams. This will cause a compilation error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot open a new pull request to apply changes based on this feedback
Tuntii marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type PathParams doesn't exist. This will cause a compilation error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot open a new pull request to apply changes based on this feedback
Outdated
Copilot
AI
Jan 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type PathParams doesn't exist. This will cause a compilation error.
| PathParams::new(), | |
| Default::default(), |
Tuntii marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -121,11 +121,11 @@ impl MiddlewareLayer for BodyLimitLayer { | |
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
| use crate::path_params::PathParams; | ||
Tuntii marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| use crate::request::Request; | ||
| use bytes::Bytes; | ||
| use http::{Extensions, Method}; | ||
| use proptest::prelude::*; | ||
| use std::collections::HashMap; | ||
| use std::sync::Arc; | ||
|
|
||
| /// Create a test request with the given body | ||
|
|
@@ -139,7 +139,7 @@ mod tests { | |
| let req = builder.body(()).unwrap(); | ||
| let (parts, _) = req.into_parts(); | ||
|
|
||
| Request::new(parts, body, Arc::new(Extensions::new()), HashMap::new()) | ||
| Request::new(parts, body, Arc::new(Extensions::new()), PathParams::new()) | ||
|
||
| } | ||
|
|
||
| /// Create a test request without Content-Length header | ||
|
|
@@ -150,7 +150,7 @@ mod tests { | |
| let req = builder.body(()).unwrap(); | ||
| let (parts, _) = req.into_parts(); | ||
|
|
||
| Request::new(parts, body, Arc::new(Extensions::new()), HashMap::new()) | ||
| Request::new(parts, body, Arc::new(Extensions::new()), PathParams::new()) | ||
Tuntii marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| /// Create a simple handler that returns 200 OK | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -192,13 +192,13 @@ impl Service<Request> for NextService { | |
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
| use crate::path_params::PathParams; | ||
Tuntii marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| use crate::request::Request; | ||
| use crate::response::Response; | ||
| use bytes::Bytes; | ||
| use http::{Extensions, Method, StatusCode}; | ||
| use proptest::prelude::*; | ||
| use proptest::test_runner::TestCaseError; | ||
| use std::collections::HashMap; | ||
|
|
||
| /// Create a test request with the given method and path | ||
| fn create_test_request(method: Method, path: &str) -> Request { | ||
|
|
@@ -212,7 +212,7 @@ mod tests { | |
| parts, | ||
| Bytes::new(), | ||
| Arc::new(Extensions::new()), | ||
| HashMap::new(), | ||
| PathParams::new(), | ||
|
||
| ) | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -167,11 +167,12 @@ fn generate_uuid() -> String { | |
| mod tests { | ||
| use super::*; | ||
| use crate::middleware::layer::{BoxedNext, LayerStack}; | ||
| use crate::path_params::PathParams; | ||
|
||
| use bytes::Bytes; | ||
| use http::{Extensions, Method, StatusCode}; | ||
| use proptest::prelude::*; | ||
| use proptest::test_runner::TestCaseError; | ||
| use std::collections::{HashMap, HashSet}; | ||
| use std::collections::HashSet; | ||
| use std::sync::Arc; | ||
|
|
||
| /// Create a test request with the given method and path | ||
|
|
@@ -186,7 +187,7 @@ mod tests { | |
| parts, | ||
| Bytes::new(), | ||
| Arc::new(Extensions::new()), | ||
| HashMap::new(), | ||
| PathParams::new(), | ||
|
||
| ) | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -204,6 +204,7 @@ mod tests { | |
| use super::*; | ||
| use crate::middleware::layer::{BoxedNext, LayerStack}; | ||
| use crate::middleware::request_id::RequestIdLayer; | ||
| use crate::path_params::PathParams; | ||
|
||
| use bytes::Bytes; | ||
| use http::{Extensions, Method, StatusCode}; | ||
| use proptest::prelude::*; | ||
|
|
@@ -224,7 +225,7 @@ mod tests { | |
| parts, | ||
| Bytes::new(), | ||
| Arc::new(Extensions::new()), | ||
| HashMap::new(), | ||
| PathParams::new(), | ||
|
||
| ) | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type
PathParamsis imported but doesn't exist in the codebase. This will cause a compilation error.