Skip to content

Commit

Permalink
non working
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Dec 30, 2024
1 parent 16c705b commit 149abc4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Source/AwsCommonRuntimeKit/http/HTTP2StreamManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import AwsCHttp

/// Manages a Pool of HTTP/2 Streams. Creates and manages HTTP/2 connections under the hood.
public class HTTP2StreamManager {
public class HTTP2StreamManager: @unchecked Sendable {
let rawValue: UnsafeMutablePointer<aws_http2_stream_manager>

public init(options: HTTP2StreamManagerOptions) throws {
Expand Down
57 changes: 28 additions & 29 deletions Test/AwsCommonRuntimeKitTests/http/HTTPClientTestFixture.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,34 @@ class HTTPClientTestFixture: XCBaseTestCase {

var httpResponse = HTTPResponse()
await withCheckedContinuation { (continuation: CheckedContinuation<Void, Never>) in
Task {
let httpRequestOptions: HTTPRequestOption
let httpRequestOptions: HTTPRequestOptions
if requestVersion == HTTPVersion.version_2 {
httpRequestOptions = try getHTTP2RequestOptions(
method: method,
path: path,
authority: endpoint,
body: body,
response: &httpResponse,
continuation: continuation,
onResponse: onResponse,
onBody: onBody,
onComplete: onComplete)
method: method,
path: path,
authority: endpoint,
body: body,
response: &httpResponse,
continuation: continuation,
onResponse: onResponse,
onBody: onBody,
onComplete: onComplete)
} else {
httpRequestOptions = try getHTTPRequestOptions(
method: method,
endpoint: endpoint,
path: path,
body: body,
response: &httpResponse,
continuation: continuation,
onResponse: onResponse,
onBody: onBody,
onComplete: onComplete)
method: method,
endpoint: endpoint,
path: path,
body: body,
response: &httpResponse,
continuation: continuation,
onResponse: onResponse,
onBody: onBody,
onComplete: onComplete)
}

for i in 1...numRetries+1 where httpResponse.statusCode != expectedStatus {
print("Attempt#\(i) to send an HTTP request")
let connection = try await connectionManager.acquireConnection()

XCTAssertTrue(connection.isOpen)
httpResponse.version = connection.httpVersion
XCTAssertEqual(connection.httpVersion, expectedVersion)
Expand Down Expand Up @@ -98,7 +97,7 @@ class HTTPClientTestFixture: XCBaseTestCase {
authority: authority,
body: body,
response: &httpResponse,
continutaion: continuation,
continuation: continuation,
onResponse: onResponse,
onBody: onBody,
onComplete: onComplete,
Expand Down Expand Up @@ -145,7 +144,7 @@ class HTTPClientTestFixture: XCBaseTestCase {

func getRequestOptions(request: HTTPRequestBase,
response: UnsafeMutablePointer<HTTPResponse>? = nil,
continutaion: CheckedContinuation<Void, Never>? = nil,
continuation: CheckedContinuation<Void, Never>? = nil,
onResponse: HTTPRequestOptions.OnResponse? = nil,
onBody: HTTPRequestOptions.OnIncomingBody? = nil,
onComplete: HTTPRequestOptions.OnStreamComplete? = nil,
Expand All @@ -169,7 +168,7 @@ class HTTPClientTestFixture: XCBaseTestCase {
response?.pointee.error = error
}
onComplete?(result)
continutaion?.resume()
continuation?.resume()
},
http2ManualDataWrites: http2ManualDataWrites)
}
Expand All @@ -180,7 +179,7 @@ class HTTPClientTestFixture: XCBaseTestCase {
path: String,
body: String = "",
response: UnsafeMutablePointer<HTTPResponse>? = nil,
continutaion: CheckedContinuation<Void, Never>? = nil,
continuation: CheckedContinuation<Void, Never>? = nil,
headers: [HTTPHeader] = [HTTPHeader](),
onResponse: HTTPRequestOptions.OnResponse? = nil,
onBody: HTTPRequestOptions.OnIncomingBody? = nil,
Expand All @@ -199,7 +198,7 @@ class HTTPClientTestFixture: XCBaseTestCase {
return getRequestOptions(
request: httpRequest,
response: response,
continutaion: continutaion,
continuation: continuation,
onResponse: onResponse,
onBody: onBody,
onComplete: onComplete)
Expand All @@ -212,7 +211,7 @@ class HTTPClientTestFixture: XCBaseTestCase {
body: String = "",
manualDataWrites: Bool = false,
response: UnsafeMutablePointer<HTTPResponse>? = nil,
continutaion: CheckedContinuation<Void, Never>? = nil,
continuation: CheckedContinuation<Void, Never>? = nil,
onResponse: HTTPRequestOptions.OnResponse? = nil,
onBody: HTTPRequestOptions.OnIncomingBody? = nil,
onComplete: HTTPRequestOptions.OnStreamComplete? = nil,
Expand All @@ -228,7 +227,7 @@ class HTTPClientTestFixture: XCBaseTestCase {
return getRequestOptions(
request: http2Request,
response: response,
continutaion: continutaion,
continuation: continuation,
onResponse: onResponse,
onBody: onBody,
onComplete: onComplete,
Expand Down

0 comments on commit 149abc4

Please sign in to comment.