{"action":"created","issue":{"url":"https://api.github.com/repos/Alamofire/Alamofire/issues/755","labels_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/755/labels{/name}","comments_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/755/comments","events_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/755/events","html_url":"https://github.com/Alamofire/Alamofire/issues/755","id":105869792,"number":755,"title":"Space in URL causes crash","user":{"login":"tosbaha","id":971530,"avatar_url":"https://avatars.githubusercontent.com/u/971530?v=3","gravatar_id":"","url":"https://api.github.com/users/tosbaha","html_url":"https://github.com/tosbaha","followers_url":"https://api.github.com/users/tosbaha/followers","following_url":"https://api.github.com/users/tosbaha/following{/other_user}","gists_url":"https://api.github.com/users/tosbaha/gists{/gist_id}","starred_url":"https://api.github.com/users/tosbaha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tosbaha/subscriptions","organizations_url":"https://api.github.com/users/tosbaha/orgs","repos_url":"https://api.github.com/users/tosbaha/repos","events_url":"https://api.github.com/users/tosbaha/events{/privacy}","received_events_url":"https://api.github.com/users/tosbaha/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Alamofire/Alamofire/labels/question","name":"question","color":"FF7E00"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-10T18:30:12Z","updated_at":"2015-09-11T16:20:42Z","closed_at":null,"body":"I am testing master branch with Swift 1.2 on Xcode 6.4. When Url has space inside it crashes. Example usage\r\n\r\n```swift\r\nlet url = \"http://www.example.com/abc/def.asp?k=abc def\"\r\n\r\nself.mngr.request(.GET, url)\r\n```\r\n\r\nCrashing function:\r\n\r\n```swift\r\n// MARK: - Convenience\r\nfunc URLRequest(method: Method, URLString: URLStringConvertible, headers: [String: String]? = nil) -> NSMutableURLRequest {\r\n    let mutableURLRequest = NSMutableURLRequest(URL: NSURL(string: URLString.URLString)!) //crash!\r\n    mutableURLRequest.HTTPMethod = method.rawValue \r\n    \r\n    if let headers = headers {\r\n        for (headerField, headerValue) in headers {\r\n            mutableURLRequest.setValue(headerValue, forHTTPHeaderField: headerField)\r\n        }\r\n    }\r\n    return mutableURLRequest\r\n}\r\n```\r\n\r\nIf I use ```parameters``` and use it like below\r\n```swift\r\nlet url = \"http://www.example.com/abc/def.asp\"\r\nlet parameters = [\"k\":\"abc def\"]\r\nself.mngr.request(.GET, url,parameters:parameters)\r\n```\r\nIt doesn't crash.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Alamofire/Alamofire/issues/comments/139590121","html_url":"https://github.com/Alamofire/Alamofire/issues/755#issuecomment-139590121","issue_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/755","id":139590121,"user":{"login":"tosbaha","id":971530,"avatar_url":"https://avatars.githubusercontent.com/u/971530?v=3","gravatar_id":"","url":"https://api.github.com/users/tosbaha","html_url":"https://github.com/tosbaha","followers_url":"https://api.github.com/users/tosbaha/followers","following_url":"https://api.github.com/users/tosbaha/following{/other_user}","gists_url":"https://api.github.com/users/tosbaha/gists{/gist_id}","starred_url":"https://api.github.com/users/tosbaha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tosbaha/subscriptions","organizations_url":"https://api.github.com/users/tosbaha/orgs","repos_url":"https://api.github.com/users/tosbaha/repos","events_url":"https://api.github.com/users/tosbaha/events{/privacy}","received_events_url":"https://api.github.com/users/tosbaha/received_events","type":"User","site_admin":false},"created_at":"2015-09-11T16:20:42Z","updated_at":"2015-09-11T16:20:42Z","body":"What I mean is, Alamofire could check if URL is valid instead of implicitly unwrapping it. Another way is encoding URL with something like escape function in ParameterEncoding.swift. I refactored all my code to use either parameters and when there are no parameters I use string extension to escape. "}}