Skip to content

ResponseAccumulator is now public #155

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

Merged
merged 1 commit into from
Jan 20, 2020
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 Sources/AsyncHTTPClient/HTTPHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ extension HTTPClient {
}
}

internal class ResponseAccumulator: HTTPClientResponseDelegate {
public class ResponseAccumulator: HTTPClientResponseDelegate {
public typealias Response = HTTPClient.Response

enum State {
Expand All @@ -255,11 +255,11 @@ internal class ResponseAccumulator: HTTPClientResponseDelegate {
var state = State.idle
let request: HTTPClient.Request

init(request: HTTPClient.Request) {
public init(request: HTTPClient.Request) {
self.request = request
}

func didReceiveHead(task: HTTPClient.Task<Response>, _ head: HTTPResponseHead) -> EventLoopFuture<Void> {
public func didReceiveHead(task: HTTPClient.Task<Response>, _ head: HTTPResponseHead) -> EventLoopFuture<Void> {
switch self.state {
case .idle:
self.state = .head(head)
Expand All @@ -275,7 +275,7 @@ internal class ResponseAccumulator: HTTPClientResponseDelegate {
return task.eventLoop.makeSucceededFuture(())
}

func didReceiveBodyPart(task: HTTPClient.Task<Response>, _ part: ByteBuffer) -> EventLoopFuture<Void> {
public func didReceiveBodyPart(task: HTTPClient.Task<Response>, _ part: ByteBuffer) -> EventLoopFuture<Void> {
switch self.state {
case .idle:
preconditionFailure("no head received before body")
Expand All @@ -293,11 +293,11 @@ internal class ResponseAccumulator: HTTPClientResponseDelegate {
return task.eventLoop.makeSucceededFuture(())
}

func didReceiveError(task: HTTPClient.Task<Response>, _ error: Error) {
public func didReceiveError(task: HTTPClient.Task<Response>, _ error: Error) {
self.state = .error(error)
}

func didFinishRequest(task: HTTPClient.Task<Response>) throws -> Response {
public func didFinishRequest(task: HTTPClient.Task<Response>) throws -> Response {
switch self.state {
case .idle:
preconditionFailure("no head received before end")
Expand Down