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 auhorization typo #695

Merged
merged 2 commits into from
Jun 30, 2023
Merged
Changes from all 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
12 changes: 6 additions & 6 deletions Tests/AsyncHTTPClientTests/HTTPClientTestUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ internal final class HTTPBin<RequestHandler: ChannelInboundHandler> where

let responseEncoder = HTTPResponseEncoder()
let requestDecoder = ByteToMessageHandler(HTTPRequestDecoder(leftOverBytesStrategy: .forwardBytes))
let proxySimulator = HTTPProxySimulator(promise: promise, expectedAuhorization: expectedAuthorization)
let proxySimulator = HTTPProxySimulator(promise: promise, expectedAuthorization: expectedAuthorization)

try sync.addHandler(responseEncoder)
try sync.addHandler(requestDecoder)
Expand Down Expand Up @@ -660,13 +660,13 @@ final class HTTPProxySimulator: ChannelInboundHandler, RemovableChannelHandler {

// the promise to succeed, once the proxy connection is setup
let promise: EventLoopPromise<Void>
let expectedAuhorization: String?
let expectedAuthorization: String?

var head: HTTPResponseHead

init(promise: EventLoopPromise<Void>, expectedAuhorization: String?) {
init(promise: EventLoopPromise<Void>, expectedAuthorization: String?) {
self.promise = promise
self.expectedAuhorization = expectedAuhorization
self.expectedAuthorization = expectedAuthorization
self.head = HTTPResponseHead(version: .init(major: 1, minor: 1), status: .ok, headers: .init([("Content-Length", "0")]))
}

Expand All @@ -679,9 +679,9 @@ final class HTTPProxySimulator: ChannelInboundHandler, RemovableChannelHandler {
return
}

if let expectedAuhorization = self.expectedAuhorization {
if let expectedAuthorization = self.expectedAuthorization {
guard let authorization = head.headers["proxy-authorization"].first,
expectedAuhorization == authorization else {
expectedAuthorization == authorization else {
self.head.status = .proxyAuthenticationRequired
return
}
Expand Down