File tree 2 files changed +13
-1
lines changed
Sources/PhantomKitAPI/API 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public protocol APIEndpoint {
36
36
37
37
extension APIEndpoint {
38
38
public func urlRequest( ) throws -> URLRequest {
39
- guard let url = URL ( string: baseURL) ? . appending ( component : path) else {
39
+ guard let url = URL ( string: baseURL) ? . appending ( path : path) else {
40
40
throw APIError . invalidURL
41
41
}
42
42
return try URLRequest ( url: url) . applying {
Original file line number Diff line number Diff line change @@ -46,6 +46,18 @@ extension APIEndpointTests {
46
46
XCTAssertEqual ( request. httpBody, . test)
47
47
}
48
48
49
+ func test_urlRequest_longPath( ) throws {
50
+ let endpoint : APIEndpoint = TestAPIEndpoint (
51
+ baseURL: " https://api.example.com " ,
52
+ path: " /test/a/s/v " ,
53
+ method: . get
54
+ )
55
+
56
+ let request = try endpoint. urlRequest ( )
57
+
58
+ XCTAssertEqual ( request. url? . absoluteString, " https://api.example.com/test/a/s/v " )
59
+ }
60
+
49
61
func test_urlRequest_invalidURL( ) throws {
50
62
let endpoint : APIEndpoint = TestAPIEndpoint (
51
63
baseURL: " $xyz://api.example.com " ,
You can’t perform that action at this time.
0 commit comments