Skip to content

Commit

Permalink
1.7.15
Browse files Browse the repository at this point in the history
  • Loading branch information
dankinsoid committed Apr 13, 2024
1 parent cfd9dcc commit 78871a0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 13 deletions.
1 change: 0 additions & 1 deletion Sources/SwiftAPIClient/Modifiers/RequestModifiers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ public extension RequestBuilder where Request == HTTPRequestComponents {
modifyRequest { req, configs in
let items = try items(configs)
guard !items.isEmpty else { return }
req.appendPath("")
let itemsToAdd: [URLQueryItem]
if percentEncoded {
itemsToAdd = items
Expand Down
6 changes: 0 additions & 6 deletions Sources/SwiftAPIClient/Types/HTTPRequestComponents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,6 @@ public struct HTTPRequestComponents: Sendable, Hashable {
} else {
urlComponents.path += path
}
if !urlComponents.path.isEmpty, !urlComponents.path.hasSuffix("/") {
urlComponents.path += "/"
}
}

public mutating func prependPath(
Expand All @@ -230,9 +227,6 @@ public struct HTTPRequestComponents: Sendable, Hashable {
} else {
urlComponents.path = path + urlComponents.path
}
if !urlComponents.path.isEmpty, !urlComponents.path.hasSuffix("/") {
urlComponents.path += "/"
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class RequestModifiersTests: XCTestCase {

let modifiedClient = client.path("users", "123")

try XCTAssertEqual(modifiedClient.request().url?.absoluteString, "https://example.com/users/123/")
try XCTAssertEqual(modifiedClient.request().url?.absoluteString, "https://example.com/users/123")
}

func testMethodSetting() throws {
Expand Down Expand Up @@ -61,7 +61,7 @@ final class RequestModifiersTests: XCTestCase {
func testQueryParametersAdding() throws {
let modifiedClient = client.query("page", "some parameter ❤️")

try XCTAssertEqual(modifiedClient.request().url?.absoluteString, "https://example.com/?page=some%20parameter%20%E2%9D%A4%EF%B8%8F")
try XCTAssertEqual(modifiedClient.request().url?.absoluteString, "https://example.com?page=some%20parameter%20%E2%9D%A4%EF%B8%8F")
}

func testBaseURLSetting() throws {
Expand All @@ -70,9 +70,7 @@ final class RequestModifiersTests: XCTestCase {
}

func testRemoveSlashIfNeeded() throws {
let modifiedClient = client.query("test", "value").modifyRequest {
$0.urlComponents.path.removeLast()
}
let modifiedClient = client.query("test", "value")
try XCTAssertEqual(modifiedClient.request().url?.absoluteString, "https://example.com?test=value")
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/SwiftAPIClientTests/URLQueryEncoderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ final class FormURLEncoderTests: XCTestCase {
.withRequest { components, _ in
components.url!
}
XCTAssertEqual(url.absoluteString, "https://example.com/?q=remaster%2520track%3ADoxy%2520artist%3AMiles%2520Davis")
XCTAssertEqual(url.absoluteString, "https://example.com?q=remaster%2520track%3ADoxy%2520artist%3AMiles%2520Davis")
}

func testThatIllegalASCIICharactersArePercentEscaped() {
Expand Down

0 comments on commit 78871a0

Please sign in to comment.