{"action":"created","issue":{"url":"https://api.github.com/repos/Moya/Moya/issues/412","repository_url":"https://api.github.com/repos/Moya/Moya","labels_url":"https://api.github.com/repos/Moya/Moya/issues/412/labels{/name}","comments_url":"https://api.github.com/repos/Moya/Moya/issues/412/comments","events_url":"https://api.github.com/repos/Moya/Moya/issues/412/events","html_url":"https://github.com/Moya/Moya/issues/412","id":135652985,"number":412,"title":"Failure code 999","user":{"login":"remirobert","id":3276768,"avatar_url":"https://avatars.githubusercontent.com/u/3276768?v=3","gravatar_id":"","url":"https://api.github.com/users/remirobert","html_url":"https://github.com/remirobert","followers_url":"https://api.github.com/users/remirobert/followers","following_url":"https://api.github.com/users/remirobert/following{/other_user}","gists_url":"https://api.github.com/users/remirobert/gists{/gist_id}","starred_url":"https://api.github.com/users/remirobert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/remirobert/subscriptions","organizations_url":"https://api.github.com/users/remirobert/orgs","repos_url":"https://api.github.com/users/remirobert/repos","events_url":"https://api.github.com/users/remirobert/events{/privacy}","received_events_url":"https://api.github.com/users/remirobert/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2016-02-23T06:45:51Z","updated_at":"2016-06-19T18:44:18Z","closed_at":"2016-02-24T06:38:53Z","body":"Hello, I use Mayo to wrap my network in my swift app.\r\nI want to connect with my own API.\r\n\r\nI first created a test a User case : \r\n\r\n```swift\r\npublic enum UserAPI {\r\n    case Information\r\n}\r\n\r\nextension UserAPI: TargetType {\r\n    public var baseURL: NSURL { return NSURL(string: \"http://127.0.0.1:3000/user\")!}\r\n\r\n    public var path: String {\r\n        switch self {\r\n        case .Information:\r\n            return \"/\"\r\n        }\r\n    }\r\n    \r\n    public var method: Moya.Method {\r\n        return .GET\r\n    }\r\n    \r\n    public var parameters: [String: AnyObject]? {\r\n        return nil\r\n    }\r\n    \r\n    public var sampleData: NSData {\r\n        switch self {\r\n        case .Information():\r\n            return \"{}\".dataUsingEncoding(NSUTF8StringEncoding)!\r\n        }\r\n    }\r\n\r\n    public func constructProvider(target: UserAPI) -> Endpoint<UserAPI> {\r\n        let token = TokenAccess.sharedInstance.token!\r\n        let endpoint: Endpoint<UserAPI> = Endpoint<UserAPI>(URL: \"\\(target.baseURL)\\(target.path)\", sampleResponseClosure: {.NetworkResponse(200, target.sampleData)}, method: target.method, parameters: target.parameters)\r\n        return endpoint.endpointByAddingHTTPHeaderFields([\"Authorization\": \"Bearer \\(token)\"])\r\n    }\r\n}\r\n```\r\n\r\nThen the call : \r\n\r\n```swift\r\nlet provider = MoyaProvider<UserAPI>()\r\nprovider.request(UserAPI.Information) { (result) -> () in\r\n    print(\"result request : \\(result)\")\r\n}\r\n```\r\n\r\nAnd then the result : \r\n\r\n```\r\nresult request : .Failure(Underlying(Error Domain=NSURLErrorDomain Code=-999 \"cancelled\" UserInfo={NSErrorFailingURLKey=http://127.0.0.1:3000/user/, NSLocalizedDescription=cancelled, NSErrorFailingURLStringKey=http://127.0.0.1:3000/user/}))\r\n```\r\n\r\nThe base URL is okay. I am making a transition, in a network abstraction, I used **Alamofire** previously, and it worked well. I am trying to move my code to **Moya**.\r\n\r\nThanks in advance for your help. :+1: "},"comment":{"url":"https://api.github.com/repos/Moya/Moya/issues/comments/227013344","html_url":"https://github.com/Moya/Moya/issues/412#issuecomment-227013344","issue_url":"https://api.github.com/repos/Moya/Moya/issues/412","id":227013344,"user":{"login":"ealeksandrov","id":3132438,"avatar_url":"https://avatars.githubusercontent.com/u/3132438?v=3","gravatar_id":"","url":"https://api.github.com/users/ealeksandrov","html_url":"https://github.com/ealeksandrov","followers_url":"https://api.github.com/users/ealeksandrov/followers","following_url":"https://api.github.com/users/ealeksandrov/following{/other_user}","gists_url":"https://api.github.com/users/ealeksandrov/gists{/gist_id}","starred_url":"https://api.github.com/users/ealeksandrov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ealeksandrov/subscriptions","organizations_url":"https://api.github.com/users/ealeksandrov/orgs","repos_url":"https://api.github.com/users/ealeksandrov/repos","events_url":"https://api.github.com/users/ealeksandrov/events{/privacy}","received_events_url":"https://api.github.com/users/ealeksandrov/received_events","type":"User","site_admin":false},"created_at":"2016-06-19T18:44:18Z","updated_at":"2016-06-19T18:44:18Z","body":"Thanks! Looks like we need to update `Basic Usage` with similar note: https://github.com/Moya/Moya/commit/000662a026faf04953163f615663db7b44be6afe"}}
{"actor":{"display_login":"ealeksandrov"}}