forked from apple/swift-nio-http2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Motivation: As part of the work for apple#214 we need new codecs which transform `HTTP2Frame.FramePayload` to and from the appropriate request and response parts. Modifications: - Add `HTTP2FramePayloadToHTTP1ClientCodec` - Add `HTTP2FramePayloadToHTTP1ServerCodec` - Duplicate the HTTP2ToHTTP1CodecTests and update the relevant parts to use payloads instead of frames. - Add relevant test helpers. - Note: the HTTP2 to HTTP1 (frame based) codecs haven't been deprecated: doing so without warnings depends on apple#221. Result: - We can transform `HTTP2Frame.FramePayload` types to the relevant HTTP client and server request and response types.
- Loading branch information
Showing
7 changed files
with
1,005 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
Tests/NIOHTTP2Tests/HTTP2FramePayloadToHTTP1CodecTests+XCTest.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// HTTP2FramePayloadToHTTP1CodecTests+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 HTTP2FramePayloadToHTTP1CodecTests { | ||
|
||
static var allTests : [(String, (HTTP2FramePayloadToHTTP1CodecTests) -> () throws -> Void)] { | ||
return [ | ||
("testBasicRequestServerSide", testBasicRequestServerSide), | ||
("testRequestWithOnlyHeadServerSide", testRequestWithOnlyHeadServerSide), | ||
("testRequestWithTrailers", testRequestWithTrailers), | ||
("testSendingSimpleResponse", testSendingSimpleResponse), | ||
("testResponseWithoutTrailers", testResponseWithoutTrailers), | ||
("testResponseWith100Blocks", testResponseWith100Blocks), | ||
("testPassingPromisesThroughWritesOnServer", testPassingPromisesThroughWritesOnServer), | ||
("testBasicResponseClientSide", testBasicResponseClientSide), | ||
("testResponseWithOnlyHeadClientSide", testResponseWithOnlyHeadClientSide), | ||
("testResponseWithTrailers", testResponseWithTrailers), | ||
("testSendingSimpleRequest", testSendingSimpleRequest), | ||
("testRequestWithoutTrailers", testRequestWithoutTrailers), | ||
("testResponseWith100BlocksClientSide", testResponseWith100BlocksClientSide), | ||
("testPassingPromisesThroughWritesOnClient", testPassingPromisesThroughWritesOnClient), | ||
("testReceiveRequestWithoutMethod", testReceiveRequestWithoutMethod), | ||
("testReceiveRequestWithDuplicateMethod", testReceiveRequestWithDuplicateMethod), | ||
("testReceiveRequestWithoutPath", testReceiveRequestWithoutPath), | ||
("testReceiveRequestWithDuplicatePath", testReceiveRequestWithDuplicatePath), | ||
("testReceiveRequestWithoutAuthority", testReceiveRequestWithoutAuthority), | ||
("testReceiveRequestWithDuplicateAuthority", testReceiveRequestWithDuplicateAuthority), | ||
("testReceiveRequestWithoutScheme", testReceiveRequestWithoutScheme), | ||
("testReceiveRequestWithDuplicateScheme", testReceiveRequestWithDuplicateScheme), | ||
("testReceiveResponseWithoutStatus", testReceiveResponseWithoutStatus), | ||
("testReceiveResponseWithDuplicateStatus", testReceiveResponseWithDuplicateStatus), | ||
("testReceiveResponseWithNonNumericalStatus", testReceiveResponseWithNonNumericalStatus), | ||
("testSendRequestWithoutHost", testSendRequestWithoutHost), | ||
("testSendRequestWithDuplicateHost", testSendRequestWithDuplicateHost), | ||
("testFramesWithoutHTTP1EquivalentAreIgnored", testFramesWithoutHTTP1EquivalentAreIgnored), | ||
("testWeTolerateUpperCasedHTTP1HeadersForRequests", testWeTolerateUpperCasedHTTP1HeadersForRequests), | ||
("testWeTolerateUpperCasedHTTP1HeadersForResponses", testWeTolerateUpperCasedHTTP1HeadersForResponses), | ||
("testWeDoNotNormalizeHeadersIfUserAskedUsNotToForRequests", testWeDoNotNormalizeHeadersIfUserAskedUsNotToForRequests), | ||
("testWeDoNotNormalizeHeadersIfUserAskedUsNotToForResponses", testWeDoNotNormalizeHeadersIfUserAskedUsNotToForResponses), | ||
("testWeStripIllegalHeadersAsWellAsTheHeadersNominatedByTheConnectionHeaderForRequests", testWeStripIllegalHeadersAsWellAsTheHeadersNominatedByTheConnectionHeaderForRequests), | ||
("testWeStripIllegalHeadersAsWellAsTheHeadersNominatedByTheConnectionHeaderForResponses", testWeStripIllegalHeadersAsWellAsTheHeadersNominatedByTheConnectionHeaderForResponses), | ||
] | ||
} | ||
} | ||
|
Oops, something went wrong.