File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -840,6 +840,14 @@ extension TaskHandler: ChannelDuplexHandler {
840
840
self . writeBody ( request: request, context: context)
841
841
} . flatMap {
842
842
context. eventLoop. assertInEventLoop ( )
843
+
844
+ switch self . state {
845
+ case . endOrError:
846
+ preconditionFailure ( " unexpected state on body sent " )
847
+ default :
848
+ break
849
+ }
850
+
843
851
self . state = . bodySent
844
852
if let expectedBodyLength = self . expectedBodyLength, expectedBodyLength != self . actualBodyLength {
845
853
let error = HTTPClientError . bodyLengthMismatch
@@ -849,6 +857,14 @@ extension TaskHandler: ChannelDuplexHandler {
849
857
return context. writeAndFlush ( self . wrapOutboundOut ( . end( nil ) ) )
850
858
} . map {
851
859
context. eventLoop. assertInEventLoop ( )
860
+
861
+ switch self . state {
862
+ case . endOrError:
863
+ preconditionFailure ( " unexpected state on sent " )
864
+ default :
865
+ break
866
+ }
867
+
852
868
self . state = . sent
853
869
self . callOutToDelegateFireAndForget ( self . delegate. didSendRequest)
854
870
} . flatMapErrorThrowing { error in
You can’t perform that action at this time.
0 commit comments