Skip to content
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

feat(middleware): add response extractor. #816

Open
wants to merge 1 commit into
base: feat/v0.4
Choose a base branch
from

Conversation

andysim3d
Copy link
Collaborator

@andysim3d andysim3d commented Sep 26, 2024

[Closes/Fixes] #812

Proposed Changes

  • impl a reponse code extractor. choose to use string to represent the response code because the value range various from HTTP(u16) to grpc(i32) to provider(i64). worries there will be wider range in the future so choose string here.

@@ -17,3 +17,9 @@ pub trait RequestExtractor<R>: Copy + Sync + Send {
/// Get method name.
fn get_method_name(request: &R) -> String;
}

/// Trait to extract response code.
pub trait ResponseExtractor<R>: Copy + Sync + Send {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be Copy? Thats a pretty strict bound to put on a trait

/// Trait to extract response code.
pub trait ResponseExtractor<R>: Copy + Sync + Send {
/// Get response code.
fn get_response_code(response: &R) -> String;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the code a string?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants