Skip to content

Commit

Permalink
fix naming: HTTPVerb ==> HTTPMethod
Browse files Browse the repository at this point in the history
  • Loading branch information
Elijah Rappaport committed Apr 3, 2022
1 parent 37c21d8 commit d789613
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Sources/Networking/Calls/NetworkingClient+Requests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public extension NetworkingClient {
request(.delete, route, params: params)
}

internal func request(_ httpVerb: HTTPVerb, _ route: String, params: Params = Params()) -> NetworkingRequest {
internal func request(_ httpMethod: HTTPMethod, _ route: String, params: Params = Params()) -> NetworkingRequest {
let req = NetworkingRequest()
req.httpVerb = httpVerb
req.httpMethod = httpMethod
req.route = route
req.params = params

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//
// HTTPVerb.swift
// HTTPMethod.swift
//
//
// Created by Sacha DSO on 30/01/2020.
//

import Foundation

public enum HTTPVerb: String {
public enum HTTPMethod: String {
case get = "GET"
case put = "PUT"
case patch = "PATCH"
Expand Down
4 changes: 2 additions & 2 deletions Sources/Networking/Logging/NetworkingLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class NetworkingLogger {
guard logLevel != .off else {
return
}
if let verb = request.httpMethod,
if let method = request.httpMethod,
let url = request.url {
print("\(verb) '\(url.absoluteString)'")
print("\(method) '\(url.absoluteString)'")
logHeaders(request)
logBody(request)

Expand Down
10 changes: 5 additions & 5 deletions Sources/Networking/NetworkingRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class NetworkingRequest: NSObject {
var parameterEncoding = ParameterEncoding.urlEncoded
var baseURL = ""
var route = ""
var httpVerb = HTTPVerb.get
var httpMethod = HTTPMethod.get
public var params = Params()
var headers = [String: String]()
var multipartData: [MultipartData]?
Expand Down Expand Up @@ -137,7 +137,7 @@ public class NetworkingRequest: NSObject {

internal func buildURLRequest() -> URLRequest? {
var urlString = baseURL + route
if httpVerb == .get {
if httpMethod == .get {
urlString = getURLWithParams()
}

Expand All @@ -146,7 +146,7 @@ public class NetworkingRequest: NSObject {
}
var request = URLRequest(url: url)

if httpVerb != .get && multipartData == nil {
if httpMethod != .get && multipartData == nil {
switch parameterEncoding {
case .urlEncoded:
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
Expand All @@ -155,7 +155,7 @@ public class NetworkingRequest: NSObject {
}
}

request.httpMethod = httpVerb.rawValue
request.httpMethod = httpMethod.rawValue
for (key, value) in headers {
request.setValue(value, forHTTPHeaderField: key)
}
Expand All @@ -164,7 +164,7 @@ public class NetworkingRequest: NSObject {
request.timeoutInterval = timeout
}

if httpVerb != .get && multipartData == nil {
if httpMethod != .get && multipartData == nil {
switch parameterEncoding {
case .urlEncoded:
request.httpBody = params.asPercentEncodedString().data(using: .utf8)
Expand Down

0 comments on commit d789613

Please sign in to comment.