-
Notifications
You must be signed in to change notification settings - Fork 125
Collect function fix #672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Collect function fix #672
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
668b33a
Collect function fix
carolinacass 6276e51
minor change
carolinacass 104eff5
Merge branch 'main' into cc-collectResponse
carolinacass 2ad4a6b
putting back in tests accidentally deleted
carolinacass e919181
Fixing comment
carolinacass df627a5
incorrect ordering
carolinacass 8156844
Main to this file
carolinacass 9b63815
Checking the Content Length through requestMethod and status
carolinacass e8d8f85
minor move
carolinacass 0de9e27
Changing placement and fixing tests to expectecdContentLength
carolinacass 045a063
suggested fixes
carolinacass 9dc6f33
fixing comments and deleting excess functions
carolinacass ecbcd90
getting rid of request Method
carolinacass ae17940
adding tests for expectedContentLength and public init
carolinacass 483a3f2
Fixing test and spelling
carolinacass 14cfdd4
running generate_linux_tests.rb
carolinacass e60d65b
fixing formatting
carolinacass 2fbef23
Merge branch 'main' into cc-collectResponse
Lukasa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
35 changes: 35 additions & 0 deletions
35
Tests/AsyncHTTPClientTests/HTTPClientResponseTests+XCTest.swift
This file contains hidden or 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,35 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the AsyncHTTPClient open source project | ||
// | ||
// Copyright (c) 2018-2019 Apple Inc. and the AsyncHTTPClient project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.txt for the list of AsyncHTTPClient project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// HTTPClientResponseTests+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 HTTPClientResponseTests { | ||
static var allTests: [(String, (HTTPClientResponseTests) -> () throws -> Void)] { | ||
return [ | ||
("testSimpleResponse", testSimpleResponse), | ||
("testSimpleResponseNotModified", testSimpleResponseNotModified), | ||
("testSimpleResponseHeadRequestMethod", testSimpleResponseHeadRequestMethod), | ||
("testResponseNoContentLengthHeader", testResponseNoContentLengthHeader), | ||
("testResponseInvalidInteger", testResponseInvalidInteger), | ||
] | ||
} | ||
} |
This file contains hidden or 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,45 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the AsyncHTTPClient open source project | ||
// | ||
// Copyright (c) 2023 Apple Inc. and the AsyncHTTPClient project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.txt for the list of AsyncHTTPClient project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
@testable import AsyncHTTPClient | ||
import Logging | ||
import NIOCore | ||
import XCTest | ||
|
||
final class HTTPClientResponseTests: XCTestCase { | ||
func testSimpleResponse() { | ||
let response = HTTPClientResponse.expectedContentLength(requestMethod: .GET, headers: ["content-length": "1025"], status: .ok) | ||
XCTAssertEqual(response, 1025) | ||
} | ||
|
||
func testSimpleResponseNotModified() { | ||
let response = HTTPClientResponse.expectedContentLength(requestMethod: .GET, headers: ["content-length": "1025"], status: .notModified) | ||
XCTAssertEqual(response, 0) | ||
} | ||
|
||
func testSimpleResponseHeadRequestMethod() { | ||
let response = HTTPClientResponse.expectedContentLength(requestMethod: .HEAD, headers: ["content-length": "1025"], status: .ok) | ||
XCTAssertEqual(response, 0) | ||
} | ||
dnadoba marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
func testResponseNoContentLengthHeader() { | ||
let response = HTTPClientResponse.expectedContentLength(requestMethod: .GET, headers: [:], status: .ok) | ||
XCTAssertEqual(response, nil) | ||
} | ||
|
||
func testResponseInvalidInteger() { | ||
let response = HTTPClientResponse.expectedContentLength(requestMethod: .GET, headers: ["content-length": "none"], status: .ok) | ||
XCTAssertEqual(response, nil) | ||
} | ||
} |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.