Skip to content

Commit

Permalink
Fixed not correctly converting bytes into String
Browse files Browse the repository at this point in the history
  • Loading branch information
OrkhanAlikhanov committed Jul 15, 2017
1 parent e8441b9 commit 8e0d1b5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Tests/HttpSwiftTests/HttpSwiftTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ extension Requester {
typealias ResponseString = (value: String, response: RequestSwift.Response?, error: Error?)
func responseString(_ handlr: @escaping ( (ResponseString) -> Void)) {
let h: ResponseHandler = { (res: RequestSwift.Response?, error: Error?) in
handlr((String(cString: res?.body ?? []), res, error))
let bytes = res?.body ?? [UInt8]()
handlr((String(data: Data(bytes: bytes, count: bytes.count), encoding: .utf8)!, res, error))
}
self.response(h)
}
Expand Down

0 comments on commit 8e0d1b5

Please sign in to comment.