You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here a test that shows the issue (currently gets stuck because of #250 the server just never replies)
func testBodyUploadAfterEndFails(){leturl=self.defaultHTTPBinURLPrefix +"/post"func uploader(_ streamWriter:HTTPClient.Body.StreamWriter)->EventLoopFuture<Void>{letdone= streamWriter.write(.byteBuffer(ByteBuffer(string:"X")))
done.recover{ error ->VoidinXCTFail("unexpected error \(error)")}.whenSuccess{
// This is executed when we have already sent the end of the request.
done.eventLoop.execute{
streamWriter.write(.byteBuffer(ByteBuffer(string:"BAD BAD BAD"))).whenComplete{ result inswitch result {case.success:XCTFail("we succeeded writing bytes after the end!?")case.failure(let error):XCTFail("\(error)")}}}}return done
}XCTAssertThrowsError(tryself.defaultClient.execute(request:Request(url: url,
body:.stream(length:1, uploader))).wait()){ error in
// TODO: check that the request fails with the appropriate error (or decide that that's okay)
}
// Quickly try another request and check that it works. If we by accident wrote some extra bytes into the
// stream (and reuse the connection) that could cause problems.
XCTAssertNoThrow(tryself.defaultClient.get(url:self.defaultHTTPBinURLPrefix +"/get").wait())}
I can probably be convinced that this is programmer error and we'd just preconditionFailure. I don't know, we definitely need to do something (and test that behaviour).
The text was updated successfully, but these errors were encountered:
Here a test that shows the issue (currently gets stuck because of #250 the server just never replies)
I can probably be convinced that this is programmer error and we'd just
preconditionFailure
. I don't know, we definitely need to do something (and test that behaviour).The text was updated successfully, but these errors were encountered: