Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlabelle committed Aug 28, 2023
1 parent 0896f3d commit b04252d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/HTTPWebDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ public struct HTTPWebDriver: WebDriver {

private func buildURLRequest<Request: WebDriverRequest>(_ request: Request) throws -> URLRequest {
var url = rootURL
for pathComponent in request.pathComponents {
url.appendPathComponent(pathComponent)
for (index, pathComponent) in request.pathComponents.enumerated() {
let last = index == request.pathComponents.count - 1
url.appendPathComponent(pathComponent, isDirectory: !last)
}

var urlRequest = URLRequest(url: url)
Expand All @@ -37,7 +38,6 @@ public struct HTTPWebDriver: WebDriver {

// Add the body if the WebDriverRequest type defines one
if Request.Body.self != CodableNone.self {
urlRequest.addValue("content-encoding", forHTTPHeaderField: "json")
urlRequest.addValue("application/json;charset=UTF-8", forHTTPHeaderField: "content-type")
urlRequest.httpBody = try JSONEncoder().encode(request.body)
}
Expand Down

0 comments on commit b04252d

Please sign in to comment.