{"action":"created","comment":{"url":"https://api.github.com/repos/Martum/go-balancer/pulls/comments/126266491","pull_request_review_id":48740879,"id":126266491,"diff_hunk":"@@ -20,50 +18,69 @@ func main() {\n \n \tgo routes.Router(routerChan, configuration.ReglasRuteo, configuration.EsperaRecuperoServer)\n \n-\tfmt.Println(configuration)\n-\n \thttp.HandleFunc(\"/\", handleIndex)\n \n-\tlog.Fatal(http.ListenAndServe(\":8080\", nil))\n+\tlog.Fatal(http.ListenAndServe(\":\" + strconv.Itoa(configuration.Puerto), nil))\n }\n \n func handleIndex(res http.ResponseWriter, req *http.Request) {\n-\tvar client = &http.Client{\n-\t\tTimeout: time.Second * 10,\n-\t}\n+\tresponse, statusError := forwardRequest(req)\n \n-\treq, err := http.NewRequest(req.Method, nextUrl(req), req.Body)\n+\tif response == nil {\n+\t\tres.WriteHeader(statusError)\n+\t} else {\n+\t\tres.WriteHeader(response.StatusCode)\n \n-\tlog.Println(req)\n+\t\tbodyBytes, _ := ioutil.ReadAll(response.Body)\n \n-\tif err != nil {\n-\t\tlog.Fatal(err)\n+\t\tres.Write(bodyBytes)\n \t}\n+}\n \n-\tresponse, err := client.Do(req)\n-\n-\tif err != nil {\n-\t\tlog.Fatal(err)\n+func forwardRequest(req *http.Request) (*http.Response, int){\n+\tvar client = &http.Client{\n+\t\tTimeout: time.Second * 5,\n \t}\n \n-\tbodyBytes, err := ioutil.ReadAll(response.Body)\n-\n-\tif err != nil {\n-\t\tlog.Fatal(err)\n+\tfor {","path":"src/main.go","position":63,"original_position":63,"commit_id":"fabec42f8f4ff4f583f4f04bf13578091e37892a","original_commit_id":"fabec42f8f4ff4f583f4f04bf13578091e37892a","user":{"login":"Martum","id":1307657,"avatar_url":"https://avatars3.githubusercontent.com/u/1307657?v=3","gravatar_id":"","url":"https://api.github.com/users/Martum","html_url":"https://github.com/Martum","followers_url":"https://api.github.com/users/Martum/followers","following_url":"https://api.github.com/users/Martum/following{/other_user}","gists_url":"https://api.github.com/users/Martum/gists{/gist_id}","starred_url":"https://api.github.com/users/Martum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Martum/subscriptions","organizations_url":"https://api.github.com/users/Martum/orgs","repos_url":"https://api.github.com/users/Martum/repos","events_url":"https://api.github.com/users/Martum/events{/privacy}","received_events_url":"https://api.github.com/users/Martum/received_events","type":"User","site_admin":false},"body":"Interesante 🤔 ","created_at":"2017-07-07T23:54:23Z","updated_at":"2017-07-07T23:54:53Z","html_url":"https://github.com/Martum/go-balancer/pull/8#discussion_r126266491","pull_request_url":"https://api.github.com/repos/Martum/go-balancer/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/Martum/go-balancer/pulls/comments/126266491"},"html":{"href":"https://github.com/Martum/go-balancer/pull/8#discussion_r126266491"},"pull_request":{"href":"https://api.github.com/repos/Martum/go-balancer/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/Martum/go-balancer/pulls/8","id":129318141,"html_url":"https://github.com/Martum/go-balancer/pull/8","diff_url":"https://github.com/Martum/go-balancer/pull/8.diff","patch_url":"https://github.com/Martum/go-balancer/pull/8.patch","issue_url":"https://api.github.com/repos/Martum/go-balancer/issues/8","number":8,"state":"open","locked":false,"title":"Notify server down","user":{"login":"santiagopereztorre","id":3731802,"avatar_url":"https://avatars0.githubusercontent.com/u/3731802?v=3","gravatar_id":"","url":"https://api.github.com/users/santiagopereztorre","html_url":"https://github.com/santiagopereztorre","followers_url":"https://api.github.com/users/santiagopereztorre/followers","following_url":"https://api.github.com/users/santiagopereztorre/following{/other_user}","gists_url":"https://api.github.com/users/santiagopereztorre/gists{/gist_id}","starred_url":"https://api.github.com/users/santiagopereztorre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santiagopereztorre/subscriptions","organizations_url":"https://api.github.com/users/santiagopereztorre/orgs","repos_url":"https://api.github.com/users/santiagopereztorre/repos","events_url":"https://api.github.com/users/santiagopereztorre/events{/privacy}","received_events_url":"https://api.github.com/users/santiagopereztorre/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-07-07T02:31:41Z","updated_at":"2017-07-07T23:54:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"076a99800ac08c4ae1f4a29450aa15399967a7bc","assignee":{"login":"santiagopereztorre","id":3731802,"avatar_url":"https://avatars0.githubusercontent.com/u/3731802?v=3","gravatar_id":"","url":"https://api.github.com/users/santiagopereztorre","html_url":"https://github.com/santiagopereztorre","followers_url":"https://api.github.com/users/santiagopereztorre/followers","following_url":"https://api.github.com/users/santiagopereztorre/following{/other_user}","gists_url":"https://api.github.com/users/santiagopereztorre/gists{/gist_id}","starred_url":"https://api.github.com/users/santiagopereztorre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santiagopereztorre/subscriptions","organizations_url":"https://api.github.com/users/santiagopereztorre/orgs","repos_url":"https://api.github.com/users/santiagopereztorre/repos","events_url":"https://api.github.com/users/santiagopereztorre/events{/privacy}","received_events_url":"https://api.github.com/users/santiagopereztorre/received_events","type":"User","site_admin":false},"assignees":[{"login":"santiagopereztorre","id":3731802,"avatar_url":"https://avatars0.githubusercontent.com/u/3731802?v=3","gravatar_id":"","url":"https://api.github.com/users/santiagopereztorre","html_url":"https://github.com/santiagopereztorre","followers_url":"https://api.github.com/users/santiagopereztorre/followers","following_url":"https://api.github.com/users/santiagopereztorre/following{/other_user}","gists_url":"https://api.github.com/users/santiagopereztorre/gists{/gist_id}","starred_url":"https://api.github.com/users/santiagopereztorre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/santiagopereztorre/subscriptions","organizations_url":"https://api.github.com/users/santiagopereztorre/orgs","repos_url":"https://api.github.com/users/santiagopereztorre/repos","events_url":"https://api.github.com/users/santiagopereztorre/events{/privacy}","received_events_url":"https://api.github.com/users/santiagopereztorre/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/Martum/go-balancer/pulls/8/commits","review_comments_url":"https://api.github.com/repos/Martum/go-balancer/pulls/8/comments","review_comment_url":"https://api.github.com/repos/Martum/go-balancer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Martum/go-balancer/issues/8/comments","statuses_url":"https://api.github.com/repos/Martum/go-balancer/statuses/fabec42f8f4ff4f583f4f04bf13578091e37892a","head":{"label":"Martum:error-in-main","ref":"error-in-main","sha":"fabec42f8f4ff4f583f4f04bf13578091e37892a","user":{"login":"Martum","id":1307657,"avatar_url":"https://avatars3.githubusercontent.com/u/1307657?v=3","gravatar_id":"","url":"https://api.github.com/users/Martum","html_url":"https://github.com/Martum","followers_url":"https://api.github.com/users/Martum/followers","following_url":"https://api.github.com/users/Martum/following{/other_user}","gists_url":"https://api.github.com/users/Martum/gists{/gist_id}","starred_url":"https://api.github.com/users/Martum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Martum/subscriptions","organizations_url":"https://api.github.com/users/Martum/orgs","repos_url":"https://api.github.com/users/Martum/repos","events_url":"https://api.github.com/users/Martum/events{/privacy}","received_events_url":"https://api.github.com/users/Martum/received_events","type":"User","site_admin":false},"repo":{"id":96261965,"name":"go-balancer","full_name":"Martum/go-balancer","owner":{"login":"Martum","id":1307657,"avatar_url":"https://avatars3.githubusercontent.com/u/1307657?v=3","gravatar_id":"","url":"https://api.github.com/users/Martum","html_url":"https://github.com/Martum","followers_url":"https://api.github.com/users/Martum/followers","following_url":"https://api.github.com/users/Martum/following{/other_user}","gists_url":"https://api.github.com/users/Martum/gists{/gist_id}","starred_url":"https://api.github.com/users/Martum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Martum/subscriptions","organizations_url":"https://api.github.com/users/Martum/orgs","repos_url":"https://api.github.com/users/Martum/repos","events_url":"https://api.github.com/users/Martum/events{/privacy}","received_events_url":"https://api.github.com/users/Martum/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Martum/go-balancer","description":null,"fork":false,"url":"https://api.github.com/repos/Martum/go-balancer","forks_url":"https://api.github.com/repos/Martum/go-balancer/forks","keys_url":"https://api.github.com/repos/Martum/go-balancer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Martum/go-balancer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Martum/go-balancer/teams","hooks_url":"https://api.github.com/repos/Martum/go-balancer/hooks","issue_events_url":"https://api.github.com/repos/Martum/go-balancer/issues/events{/number}","events_url":"https://api.github.com/repos/Martum/go-balancer/events","assignees_url":"https://api.github.com/repos/Martum/go-balancer/assignees{/user}","branches_url":"https://api.github.com/repos/Martum/go-balancer/branches{/branch}","tags_url":"https://api.github.com/repos/Martum/go-balancer/tags","blobs_url":"https://api.github.com/repos/Martum/go-balancer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Martum/go-balancer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Martum/go-balancer/git/refs{/sha}","trees_url":"https://api.github.com/repos/Martum/go-balancer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Martum/go-balancer/statuses/{sha}","languages_url":"https://api.github.com/repos/Martum/go-balancer/languages","stargazers_url":"https://api.github.com/repos/Martum/go-balancer/stargazers","contributors_url":"https://api.github.com/repos/Martum/go-balancer/contributors","subscribers_url":"https://api.github.com/repos/Martum/go-balancer/subscribers","subscription_url":"https://api.github.com/repos/Martum/go-balancer/subscription","commits_url":"https://api.github.com/repos/Martum/go-balancer/commits{/sha}","git_commits_url":"https://api.github.com/repos/Martum/go-balancer/git/commits{/sha}","comments_url":"https://api.github.com/repos/Martum/go-balancer/comments{/number}","issue_comment_url":"https://api.github.com/repos/Martum/go-balancer/issues/comments{/number}","contents_url":"https://api.github.com/repos/Martum/go-balancer/contents/{+path}","compare_url":"https://api.github.com/repos/Martum/go-balancer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Martum/go-balancer/merges","archive_url":"https://api.github.com/repos/Martum/go-balancer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Martum/go-balancer/downloads","issues_url":"https://api.github.com/repos/Martum/go-balancer/issues{/number}","pulls_url":"https://api.github.com/repos/Martum/go-balancer/pulls{/number}","milestones_url":"https://api.github.com/repos/Martum/go-balancer/milestones{/number}","notifications_url":"https://api.github.com/repos/Martum/go-balancer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Martum/go-balancer/labels{/name}","releases_url":"https://api.github.com/repos/Martum/go-balancer/releases{/id}","deployments_url":"https://api.github.com/repos/Martum/go-balancer/deployments","created_at":"2017-07-05T00:41:00Z","updated_at":"2017-07-05T01:32:03Z","pushed_at":"2017-07-07T02:31:41Z","git_url":"git://github.com/Martum/go-balancer.git","ssh_url":"git@github.com:Martum/go-balancer.git","clone_url":"https://github.com/Martum/go-balancer.git","svn_url":"https://github.com/Martum/go-balancer","homepage":null,"size":15,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Martum:master","ref":"master","sha":"7e12d0d3969fc5b8d63d6fbd9608b510ecd3d15c","user":{"login":"Martum","id":1307657,"avatar_url":"https://avatars3.githubusercontent.com/u/1307657?v=3","gravatar_id":"","url":"https://api.github.com/users/Martum","html_url":"https://github.com/Martum","followers_url":"https://api.github.com/users/Martum/followers","following_url":"https://api.github.com/users/Martum/following{/other_user}","gists_url":"https://api.github.com/users/Martum/gists{/gist_id}","starred_url":"https://api.github.com/users/Martum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Martum/subscriptions","organizations_url":"https://api.github.com/users/Martum/orgs","repos_url":"https://api.github.com/users/Martum/repos","events_url":"https://api.github.com/users/Martum/events{/privacy}","received_events_url":"https://api.github.com/users/Martum/received_events","type":"User","site_admin":false},"repo":{"id":96261965,"name":"go-balancer","full_name":"Martum/go-balancer","owner":{"login":"Martum","id":1307657,"avatar_url":"https://avatars3.githubusercontent.com/u/1307657?v=3","gravatar_id":"","url":"https://api.github.com/users/Martum","html_url":"https://github.com/Martum","followers_url":"https://api.github.com/users/Martum/followers","following_url":"https://api.github.com/users/Martum/following{/other_user}","gists_url":"https://api.github.com/users/Martum/gists{/gist_id}","starred_url":"https://api.github.com/users/Martum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Martum/subscriptions","organizations_url":"https://api.github.com/users/Martum/orgs","repos_url":"https://api.github.com/users/Martum/repos","events_url":"https://api.github.com/users/Martum/events{/privacy}","received_events_url":"https://api.github.com/users/Martum/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Martum/go-balancer","description":null,"fork":false,"url":"https://api.github.com/repos/Martum/go-balancer","forks_url":"https://api.github.com/repos/Martum/go-balancer/forks","keys_url":"https://api.github.com/repos/Martum/go-balancer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Martum/go-balancer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Martum/go-balancer/teams","hooks_url":"https://api.github.com/repos/Martum/go-balancer/hooks","issue_events_url":"https://api.github.com/repos/Martum/go-balancer/issues/events{/number}","events_url":"https://api.github.com/repos/Martum/go-balancer/events","assignees_url":"https://api.github.com/repos/Martum/go-balancer/assignees{/user}","branches_url":"https://api.github.com/repos/Martum/go-balancer/branches{/branch}","tags_url":"https://api.github.com/repos/Martum/go-balancer/tags","blobs_url":"https://api.github.com/repos/Martum/go-balancer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Martum/go-balancer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Martum/go-balancer/git/refs{/sha}","trees_url":"https://api.github.com/repos/Martum/go-balancer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Martum/go-balancer/statuses/{sha}","languages_url":"https://api.github.com/repos/Martum/go-balancer/languages","stargazers_url":"https://api.github.com/repos/Martum/go-balancer/stargazers","contributors_url":"https://api.github.com/repos/Martum/go-balancer/contributors","subscribers_url":"https://api.github.com/repos/Martum/go-balancer/subscribers","subscription_url":"https://api.github.com/repos/Martum/go-balancer/subscription","commits_url":"https://api.github.com/repos/Martum/go-balancer/commits{/sha}","git_commits_url":"https://api.github.com/repos/Martum/go-balancer/git/commits{/sha}","comments_url":"https://api.github.com/repos/Martum/go-balancer/comments{/number}","issue_comment_url":"https://api.github.com/repos/Martum/go-balancer/issues/comments{/number}","contents_url":"https://api.github.com/repos/Martum/go-balancer/contents/{+path}","compare_url":"https://api.github.com/repos/Martum/go-balancer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Martum/go-balancer/merges","archive_url":"https://api.github.com/repos/Martum/go-balancer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Martum/go-balancer/downloads","issues_url":"https://api.github.com/repos/Martum/go-balancer/issues{/number}","pulls_url":"https://api.github.com/repos/Martum/go-balancer/pulls{/number}","milestones_url":"https://api.github.com/repos/Martum/go-balancer/milestones{/number}","notifications_url":"https://api.github.com/repos/Martum/go-balancer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Martum/go-balancer/labels{/name}","releases_url":"https://api.github.com/repos/Martum/go-balancer/releases{/id}","deployments_url":"https://api.github.com/repos/Martum/go-balancer/deployments","created_at":"2017-07-05T00:41:00Z","updated_at":"2017-07-05T01:32:03Z","pushed_at":"2017-07-07T02:31:41Z","git_url":"git://github.com/Martum/go-balancer.git","ssh_url":"git@github.com:Martum/go-balancer.git","clone_url":"https://github.com/Martum/go-balancer.git","svn_url":"https://github.com/Martum/go-balancer","homepage":null,"size":15,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Martum/go-balancer/pulls/8"},"html":{"href":"https://github.com/Martum/go-balancer/pull/8"},"issue":{"href":"https://api.github.com/repos/Martum/go-balancer/issues/8"},"comments":{"href":"https://api.github.com/repos/Martum/go-balancer/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/Martum/go-balancer/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/Martum/go-balancer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Martum/go-balancer/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/Martum/go-balancer/statuses/fabec42f8f4ff4f583f4f04bf13578091e37892a"}}}}
{"actor":{"display_login":"Martum"}}