Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1473)

Side by Side Diff: go/src/infra/appengine/test-results/frontend/builders.go

Issue 2251623002: test-results: Get handler cleanup (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@x_3
Patch Set: (Rebase) Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | go/src/infra/appengine/test-results/frontend/get.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package frontend 1 package frontend
2 2
3 import ( 3 import (
4 "bytes" 4 "bytes"
5 "encoding/json" 5 "encoding/json"
6 "io" 6 "io"
7 "net/http" 7 "net/http"
8 "regexp" 8 "regexp"
9 "sort" 9 "sort"
10 "strings" 10 "strings"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 case nil: 99 case nil:
100 res = item.Value() 100 res = item.Value()
101 101
102 default: 102 default:
103 logging.WithError(err).Errorf(c, "builders: GetBuilders") 103 logging.WithError(err).Errorf(c, "builders: GetBuilders")
104 http.Error(w, err.Error(), http.StatusInternalServerError) 104 http.Error(w, err.Error(), http.StatusInternalServerError)
105 return 105 return
106 } 106 }
107 107
108 var out io.Reader = bytes.NewReader(res) 108 var out io.Reader = bytes.NewReader(res)
109 » if callback := r.FormValue("callback"); callback != "" { 109 » if c := r.FormValue("callback"); callbackNameRx.MatchString(c) {
110 » » out = wrapCallback(out, callback) 110 » » out = wrapCallback(out, c)
111 } 111 }
112 112
113 n, err := io.Copy(w, out) 113 n, err := io.Copy(w, out)
114 114
115 if err != nil { 115 if err != nil {
116 logging.Fields{ 116 logging.Fields{
117 logging.ErrorKey: err, 117 logging.ErrorKey: err,
118 "n": n, 118 "n": n,
119 }.Errorf(c, "builders: GetBuilders: failed to write response") 119 }.Errorf(c, "builders: GetBuilders: failed to write response")
120 } 120 }
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // data, we just keep everything before the first space. 382 // data, we just keep everything before the first space.
383 if i := strings.Index(name, " "); i != -1 { 383 if i := strings.Index(name, " "); i != -1 {
384 name = name[:i] 384 name = name[:i]
385 } 385 }
386 386
387 if withPatch { 387 if withPatch {
388 name += " (with patch)" 388 name += " (with patch)"
389 } 389 }
390 return name 390 return name
391 } 391 }
OLDNEW
« no previous file with comments | « no previous file | go/src/infra/appengine/test-results/frontend/get.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698