mirror of
https://github.com/apple/swift-nio-extras.git
synced 2025-05-22 21:39:40 +08:00
Motivation: It's possible for channels to be closed without an error; and the `RequestResponseHandler` should tolerate that by failing any promises for which it does not have a response for. Modifications: - Add `ClosedBeforeReceivingResponseError` - Fail outstanding promises with `ClosedBeforeReceivingResponseError` in `RequestResponseHandler.channelInactive` - Add a test. Result: Outstanding request promises are failed when the channel becomes inactive.
38 lines
1.3 KiB
Swift
38 lines
1.3 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftNIO open source project
|
|
//
|
|
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// RequestResponseHandlerTest+XCTest.swift
|
|
//
|
|
import XCTest
|
|
|
|
///
|
|
/// NOTE: This file was generated by generate_linux_tests.rb
|
|
///
|
|
/// Do NOT edit this file directly as it will be regenerated automatically when needed.
|
|
///
|
|
|
|
extension RequestResponseHandlerTest {
|
|
|
|
static var allTests : [(String, (RequestResponseHandlerTest) -> () throws -> Void)] {
|
|
return [
|
|
("testSimpleRequestWorks", testSimpleRequestWorks),
|
|
("testEnqueingMultipleRequestsWorks", testEnqueingMultipleRequestsWorks),
|
|
("testRequestsEnqueuedAfterErrorAreFailed", testRequestsEnqueuedAfterErrorAreFailed),
|
|
("testRequestsEnqueuedJustBeforeErrorAreFailed", testRequestsEnqueuedJustBeforeErrorAreFailed),
|
|
("testClosedConnectionFailsOutstandingPromises", testClosedConnectionFailsOutstandingPromises),
|
|
]
|
|
}
|
|
}
|
|
|