Skip to content

Commit

Permalink
fix: Add toBuilder() to SdkHttpRequest to easily allow customizations (
Browse files Browse the repository at this point in the history
…#588)

* Add toBuilder() to SdkHttpRequest.
---------

Co-authored-by: Sichan Yoo <chanyoo@amazon.com>
Co-authored-by: Josh Elkins <jbelkins@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 20, 2023
1 parent 6a77959 commit e506a16
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Sources/ClientRuntime/Networking/Http/SdkHttpRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ public class SdkHttpRequest {
self.endpoint = endpoint
self.body = body
}

public func toBuilder() -> SdkHttpRequestBuilder {
let builder = SdkHttpRequestBuilder()
.withBody(self.body)
.withMethod(self.method)
.withHeaders(self.headers)
.withPath(self.path)
.withHost(self.host)
.withPort(self.endpoint.port)
.withProtocol(self.endpoint.protocolType ?? .https)
if let qItems = self.queryItems {
builder.withQueryItems(qItems)
}
return builder
}
}

extension SdkHttpRequest {
Expand Down

0 comments on commit e506a16

Please sign in to comment.