Skip to content

Commit e9d0dd2

Browse files
authored
rename didReceivePart to didReceiveBodyPart (swift-server#84)
1 parent 3c21d3c commit e9d0dd2

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class CountingDelegate: HTTPClientResponseDelegate{
136136
return task.eventLoop.makeSucceededFuture(())
137137
}
138138

139-
funcdidReceivePart(task: HTTPClient.Task<Response>, _buffer: ByteBuffer) -> EventLoopFuture<Void>{
139+
funcdidReceiveBodyPart(task: HTTPClient.Task<Response>, _buffer: ByteBuffer) -> EventLoopFuture<Void>{
140140
// this is executed when we receive parts of the response body, could be called zero or more times
141141
count += buffer.readableBytes
142142
// in case backpressure is needed, all reads will be paused until returned future is resolved

‎Sources/AsyncHTTPClient/HTTPHandler.swift‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ internal class ResponseAccumulator: HTTPClientResponseDelegate{
230230
return task.eventLoop.makeSucceededFuture(())
231231
}
232232

233-
funcdidReceivePart(task:HTTPClient.Task<Response>, _ part:ByteBuffer)->EventLoopFuture<Void>{
233+
funcdidReceiveBodyPart(task:HTTPClient.Task<Response>, _ part:ByteBuffer)->EventLoopFuture<Void>{
234234
switchself.state {
235235
case.idle:
236236
preconditionFailure("no head received before body")
@@ -319,7 +319,7 @@ public protocol HTTPClientResponseDelegate: AnyObject{
319319
/// - task: Current request context.
320320
/// - buffer: Received body `Part`.
321321
/// - returns: `EventLoopFuture` that will be used for backpressure.
322-
funcdidReceivePart(task:HTTPClient.Task<Response>, _ buffer:ByteBuffer)->EventLoopFuture<Void>
322+
funcdidReceiveBodyPart(task:HTTPClient.Task<Response>, _ buffer:ByteBuffer)->EventLoopFuture<Void>
323323

324324
/// Called when error was thrown during request execution. Will be called zero or one time only. Request processing will be stopped after that.
325325
///
@@ -345,7 +345,7 @@ extension HTTPClientResponseDelegate{
345345

346346
publicfunc didReceiveHead(task:HTTPClient.Task<Response>, _:HTTPResponseHead)->EventLoopFuture<Void>{return task.eventLoop.makeSucceededFuture(())}
347347

348-
publicfuncdidReceivePart(task:HTTPClient.Task<Response>, _:ByteBuffer)->EventLoopFuture<Void>{return task.eventLoop.makeSucceededFuture(())}
348+
publicfuncdidReceiveBodyPart(task:HTTPClient.Task<Response>, _:ByteBuffer)->EventLoopFuture<Void>{return task.eventLoop.makeSucceededFuture(())}
349349

350350
publicfunc didReceiveError(task:HTTPClient.Task<Response>, _:Error){}
351351
}
@@ -550,7 +550,7 @@ internal class TaskHandler<T: HTTPClientResponseDelegate>: ChannelInboundHandler
550550
default:
551551
self.state =.body
552552
self.mayRead =false
553-
self.delegate.didReceivePart(task:self.task, body).whenComplete{ result in
553+
self.delegate.didReceiveBodyPart(task:self.task, body).whenComplete{ result in
554554
self.handleBackpressureResult(context: context, result: result)
555555
}
556556
}

‎Sources/AsyncHTTPClient/Utils.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public final class HTTPClientCopyingDelegate: HTTPClientResponseDelegate{
2424
self.chunkHandler = chunkHandler
2525
}
2626

27-
publicfuncdidReceivePart(task:HTTPClient.Task<Void>, _ buffer:ByteBuffer)->EventLoopFuture<Void>{
27+
publicfuncdidReceiveBodyPart(task:HTTPClient.Task<Void>, _ buffer:ByteBuffer)->EventLoopFuture<Void>{
2828
returnself.chunkHandler(buffer)
2929
}
3030

‎Tests/AsyncHTTPClientTests/HTTPClientInternalTests.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class HTTPClientInternalTests: XCTestCase{
153153
}
154154
}
155155

156-
funcdidReceivePart(task:HTTPClient.Task<Response>, _ buffer:ByteBuffer)->EventLoopFuture<Void>{
156+
funcdidReceiveBodyPart(task:HTTPClient.Task<Response>, _ buffer:ByteBuffer)->EventLoopFuture<Void>{
157157
self.lock.withLockVoid{
158158
self._reads +=1
159159
}

‎Tests/AsyncHTTPClientTests/HTTPClientTestUtils.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class TestHTTPDelegate: HTTPClientResponseDelegate{
3636
return task.eventLoop.makeSucceededFuture(())
3737
}
3838

39-
funcdidReceivePart(task:HTTPClient.Task<Response>, _ buffer:ByteBuffer)->EventLoopFuture<Void>{
39+
funcdidReceiveBodyPart(task:HTTPClient.Task<Response>, _ buffer:ByteBuffer)->EventLoopFuture<Void>{
4040
switchself.state {
4141
case.head(let head):
4242
self.state =.body(head, buffer)
@@ -58,7 +58,7 @@ class CountingDelegate: HTTPClientResponseDelegate{
5858

5959
varcount=0
6060

61-
funcdidReceivePart(task:HTTPClient.Task<Response>, _ buffer:ByteBuffer)->EventLoopFuture<Void>{
61+
funcdidReceiveBodyPart(task:HTTPClient.Task<Response>, _ buffer:ByteBuffer)->EventLoopFuture<Void>{
6262
letstr= buffer.getString(at:0, length: buffer.readableBytes)
6363
if str?.starts(with:"id:")??false{
6464
self.count +=1

0 commit comments

Comments
(0)