Skip to content

Commit

Permalink
Removed warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Jessup committed Mar 26, 2019
1 parent 8d1e4a5 commit 37c0f69
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions Sources/PerfectCURL/CURLResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,17 @@ extension CURLResponse {

public extension CURLResponse {
/// Get the URL which the request may have been redirected to.
public var url: String { return get(.url) ?? "" }
var url: String { return get(.url) ?? "" }
/// Get the HTTP response code
public var responseCode: Int { return get(.responseCode) ?? 0 }
var responseCode: Int { return get(.responseCode) ?? 0 }
/// Get the response body converted from UTF-8.
public var bodyString: String { return String(bytes: bodyBytes, encoding: .utf8) ?? "" }
var bodyString: String { return String(bytes: bodyBytes, encoding: .utf8) ?? "" }
/// Get the response body decoded from JSON into a [String:Any] dictionary.
/// Invalid/non-JSON body data will result in an empty dictionary being returned.
public var bodyJSON: [String:Any] { do { return try bodyString.jsonDecode() as? [String:Any] ?? [:] } catch { return [:] } }
var bodyJSON: [String:Any] { do { return try bodyString.jsonDecode() as? [String:Any] ?? [:] } catch { return [:] } }
/// Get the response body decoded from JSON into a decodable structure
/// Invalid/non-JSON body data will throw errors.
public func bodyJSON<T: Decodable>(_ type: T.Type) throws -> T { return try JSONDecoder().decode(type, from: Data(bytes: bodyBytes)) }
func bodyJSON<T: Decodable>(_ type: T.Type) throws -> T { return try JSONDecoder().decode(type, from: Data(bytes: bodyBytes)) }
}


Expand Down
4 changes: 2 additions & 2 deletions Sources/PerfectCURL/HTTPHeaders.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public enum HTTPRequestHeader {
case xB3TraceId, xB3SpanId, xB3ParentSpanId
case custom(name: String)

public var hashValue: Int {
return self.standardName.lowercased().hashValue
public func hash(into hasher: inout Hasher) {
hasher.combine(standardName.lowercased().hashValue)
}

public var standardName: String {
Expand Down
4 changes: 2 additions & 2 deletions Sources/PerfectCURL/HTTPMethod.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public enum HTTPMethod: Hashable, CustomStringConvertible {
}

/// Method String hash value
public var hashValue: Int {
return self.description.hashValue
public func hash(into hasher: inout Hasher) {
hasher.combine(description.hashValue)
}

/// The method as a String
Expand Down

0 comments on commit 37c0f69

Please sign in to comment.