Skip to content

Commit

Permalink
handshake(server): Make 'create_response_with_body' function more gen…
Browse files Browse the repository at this point in the history
…eric

This makes using it possible when the request and response body types differ.

Signed-off-by: bartel <bartel.sielski@gmail.com>
  • Loading branch information
bartelsielski committed Apr 23, 2024
1 parent 0fa4197 commit 60c50cd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/handshake/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ pub fn create_response(request: &Request) -> Result<Response> {
}

/// Create a response for the request with a custom body.
pub fn create_response_with_body<T>(
request: &HttpRequest<T>,
generate_body: impl FnOnce() -> T,
) -> Result<HttpResponse<T>> {
pub fn create_response_with_body<T1, T2>(
request: &HttpRequest<T1>,
generate_body: impl FnOnce() -> T2,
) -> Result<HttpResponse<T2>> {
Ok(create_parts(request)?.body(generate_body())?)
}

Expand Down

0 comments on commit 60c50cd

Please sign in to comment.