Permalink
Browse files

gofmt

  • Loading branch information...
1 parent f99e2c0 commit 165f50df67f872f0df1ed3cffa9323dd799996c4 @dgrijalva dgrijalva committed Dec 11, 2012
Showing with 20 additions and 21 deletions.
  1. +5 −6 handler_filter.go
  2. +7 −7 handler_filter_test.go
  3. +1 −1 pipeline.go
  4. +1 −1 request.go
  5. +2 −2 server.go
  6. +1 −1 server_notwindows.go
  7. +3 −3 upstream/upstream.go
View
@@ -1,9 +1,9 @@
package falcore
import (
- "net/http"
- "io"
"fmt"
+ "io"
+ "net/http"
)
// Implements a RequestFilter using a http.Handler to produce the response
@@ -13,8 +13,8 @@ type HandlerFilter struct {
handler http.Handler
}
-func NewHandlerFilter(handler http.Handler) (*HandlerFilter) {
- return &HandlerFilter{ handler: handler}
+func NewHandlerFilter(handler http.Handler) *HandlerFilter {
+ return &HandlerFilter{handler: handler}
}
func (h *HandlerFilter) FilterRequest(req *Request) *http.Response {
@@ -40,7 +40,7 @@ func newPopulateResponseWriter(req *http.Request) (*populateResponse, <-chan *ht
Header: make(http.Header),
Close: true,
Body: pr,
- Request: req,
+ Request: req,
},
}
return rw, rw.ch
@@ -105,4 +105,3 @@ func (pr *populateResponse) Write(p []byte) (n int, err error) {
}
return pr.pw.Write(p)
}
-
@@ -1,31 +1,31 @@
package falcore
import (
- "net/http"
- "testing"
"fmt"
"io/ioutil"
+ "net/http"
+ "testing"
)
func TestHandlerFilter(t *testing.T) {
reply := "Hello, World"
handler := func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, reply)
}
-
+
hff := NewHandlerFilter(http.HandlerFunc(handler))
tmp, _ := http.NewRequest("GET", "/hello", nil)
_, res := TestWithRequest(tmp, hff)
-
+
if res == nil {
t.Errorf("Response is nil")
}
-
+
if replyGot, err := ioutil.ReadAll(res.Body); err != nil {
t.Errorf("Error reading body: %v", err)
} else if string(replyGot) != reply {
t.Errorf("Expected body does not match")
}
-
-}
+
+}
View
@@ -75,7 +75,7 @@ func (p *Pipeline) execute(req *Request) (res *http.Response) {
return
}
-func (p *Pipeline) execFilter(req *Request, filter RequestFilter)*http.Response {
+func (p *Pipeline) execFilter(req *Request, filter RequestFilter) *http.Response {
if _, skipTracking := filter.(*Pipeline); !skipTracking {
t := reflect.TypeOf(filter)
req.startPipelineStage(t.String())
View
@@ -8,8 +8,8 @@ import (
"math/rand"
"net"
"net/http"
- "time"
"reflect"
+ "time"
)
// Request wrapper
View
@@ -261,11 +261,11 @@ func (srv *Server) handler(c net.Conn) {
request.finishPipelineStage()
request.finishRequest()
srv.requestFinished(request)
-
+
if res.Close {
keepAlive = false
}
-
+
// Reset the startTime
// this isn't great since there may be lag between requests; but it's the best we've got
startTime = time.Now()
@@ -41,4 +41,4 @@ func (srv *Server) cycleNonBlock(c net.Conn) {
}
}
}
-}
+}
@@ -1,13 +1,13 @@
package upstream
import (
+ "bytes"
"fmt"
"github.com/ngmoco/falcore"
+ "io"
"net"
"net/http"
"time"
- "io"
- "bytes"
)
type passThruReadCloser struct {
@@ -115,7 +115,7 @@ func (u *Upstream) FilterRequest(request *falcore.Request) (res *http.Response)
io.MultiReader(bytes.NewBuffer(testBuf[:]), upstrRes.Body),
upstrRes.Body,
}
-
+
res.Body = rc
}
} else if upstrRes.Body != nil {

0 comments on commit 165f50d

Please sign in to comment.