File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed
Sources/async-http-client/proxy/helper
Tests/async-http-clientTests/helper Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import retry_policy_service
1313/// - url: url
1414/// - query: An array of name-value pairs
1515/// - Returns: A value that identifies the location of a resource
16- internal func append( _ url: URL , with query : Http . Query ? = nil ) throws -> URL {
16+ internal func append( _ url: URL , with query : Http . Query ? = nil ) throws -> URL {
1717
1818 guard var components = URLComponents ( url: url, resolvingAgainstBaseURL: true ) else {
1919 throw URLError ( . badURL)
Original file line number Diff line number Diff line change 1+ //
2+ // UrlHelper.swift
3+ //
4+ //
5+ // Created by Igor on 17.03.2023.
6+ //
7+
8+ import XCTest
9+ @testable import async_http_client
10+
11+
12+ final class UrlHelper : XCTestCase {
13+
14+ let urlString = " http://localhost:3000 "
15+
16+ func testBuildURL( ) throws {
17+
18+ let url = URL ( string: urlString) !
19+
20+ let userEndpoint = try buildURL ( baseURL: url, for: " user " )
21+
22+ XCTAssertEqual ( userEndpoint. absoluteString, " http://localhost:3000/user " )
23+ }
24+
25+ func testAppend( ) throws {
26+
27+ let url = URL ( string: urlString) !
28+ let query = [ ( " user " , " Name " ) ]
29+ let userEndpoint = try append ( url, with: query)
30+
31+ XCTAssertEqual ( userEndpoint. absoluteString, " http://localhost:3000?user=Name " )
32+ }
33+
34+ }
You can’t perform that action at this time.
0 commit comments