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

fix: Add toBuilder() to SdkHttpRequest to easily allow customizations #588

Merged
merged 6 commits into from
Sep 20, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
self.endpoint = endpoint
self.body = body
}

Check warning on line 28 in Sources/ClientRuntime/Networking/Http/SdkHttpRequest.swift

View workflow job for this annotation

GitHub Actions / swiftlint

Lines should not have trailing whitespace (trailing_whitespace)
sichanyoo marked this conversation as resolved.
Show resolved Hide resolved
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
sichanyoo marked this conversation as resolved.
Show resolved Hide resolved
}
}

extension SdkHttpRequest {
Expand Down
Loading