Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix curl command output #178

Merged
merged 2 commits into from Oct 20, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions Source/Alamofire.swift
Expand Up @@ -1224,11 +1224,11 @@ extension Request: DebugPrintable {
let protectionSpace = NSURLProtectionSpace(host: URL.host!, port: URL.port ?? 0, `protocol`: URL.scheme, realm: URL.host, authenticationMethod: NSURLAuthenticationMethodHTTPBasic)
if let credentials = credentialStorage.credentialsForProtectionSpace(protectionSpace)?.values.array {
for credential: NSURLCredential in (credentials as [NSURLCredential]) {
components.append("-u \(credential.user):\(credential.password)")
components.append("-u \(credential.user!):\(credential.password!)")
}
} else {
if let credential = delegate.credential {
components.append("-u \(credential.user):\(credential.password)")
components.append("-u \(credential.user!):\(credential.password!)")
}
}
}
Expand Down Expand Up @@ -1261,7 +1261,9 @@ extension Request: DebugPrintable {
}

if let HTTPBody = request.HTTPBody {
components.append("-d \"\(NSString(data: HTTPBody, encoding: NSUTF8StringEncoding))\"")
let escapedBody = NSString(data: HTTPBody, encoding: NSUTF8StringEncoding)
.stringByReplacingOccurrencesOfString("\"", withString: "\\\"")
components.append("-d \"\(escapedBody)\"")
}

components.append("\"\(URL.absoluteString!)\"")
Expand Down