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 it more possible to use the library handshake creation when the
request and response body types differ.

Signed-off-by: bartel <[email protected]>
  • Loading branch information
bartelsielski committed Apr 22, 2024
1 parent 0fa4197 commit d87f396
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 d87f396

Please sign in to comment.