Merge remote-tracking branch 'upstream/master' into validate
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Jimmy Pettersson · committed by Jimmy Pettersson · parents d7f4db4, 3b079bb · Browse files · 15 files·+90 added−1 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
15 files+90 added−1 removed
- other:+90 added−1 removed
Provenance
- Commit
c4237c3- Tree
4e4219e- Author
Jimmy Pettersson <jimmy@expertmaker.com>- Committer
Jimmy Pettersson <jimmy@expertmaker.com>- Parent 1
d7f4db4- Parent 2
3b079bb
15 files changed+90 added−1 removed
modified:binding/binding.go+4 added
1+// Copyright 2014 Manu Martinez-Almeida. All rights reserved.2+// Use of this source code is governed by a MIT style3+// license that can be found in the LICENSE file.4+5 package binding6 7 import (8 "encoding/json"208 unmodified linesmodified:render/render.go+4 added
1+// Copyright 2014 Manu Martinez-Almeida. All rights reserved.2+// Use of this source code is governed by a MIT style3+// license that can be found in the LICENSE file.4+5 package render6 7 import (8 "encoding/json"93 unmodified linesmodified:auth_test.go+4 added
1+// Copyright 2014 Manu Martinez-Almeida. All rights reserved.2+// Use of this source code is governed by a MIT style3+// license that can be found in the LICENSE file.4+5 package gin6 7 import (8 "encoding/base64"53 unmodified linesmodified:auth.go+4 added
1+// Copyright 2014 Manu Martinez-Almeida. All rights reserved.2+// Use of this source code is governed by a MIT style3+// license that can be found in the LICENSE file.4+5 package gin6 7 import (8 "crypto/subtle"84 unmodified linesmodified:context_test.go+4 added
1+// Copyright 2014 Manu Martinez-Almeida. All rights reserved.2+// Use of this source code is governed by a MIT style3+// license that can be found in the LICENSE file.4+5 package gin6 7 import (8 "bytes"434 unmodified linesmodified:context.go+4 added
1+// Copyright 2014 Manu Martinez-Almeida. All rights reserved.2+// Use of this source code is governed by a MIT style3+// license that can be found in the LICENSE file.4+5 package gin6 7 import (8 "bytes"269 unmodified linesmodified:deprecated.go+4 added
1+// Copyright 2014 Manu Martinez-Almeida. All rights reserved.2+// Use of this source code is governed by a MIT style3+// license that can be found in the LICENSE file.4+5 package gin6 7 import (8 "github.com/gin-gonic/gin/binding"39 unmodified linesmodified:gin_test.go+4 added
1+// Copyright 2014 Manu Martinez-Almeida. All rights reserved.2+// Use of this source code is governed by a MIT style3+// license that can be found in the LICENSE file.4+5 package gin6 7 import (8 "io/ioutil"199 unmodified linesmodified:gin.go+4 added
1+// Copyright 2014 Manu Martinez-Almeida. All rights reserved.2+// Use of this source code is governed by a MIT style3+// license that can be found in the LICENSE file.4+5 package gin6 7 import (8 "fmt"254 unmodified linesmodified:logger.go+4 added
1+// Copyright 2014 Manu Martinez-Almeida. All rights reserved.2+// Use of this source code is governed by a MIT style3+// license that can be found in the LICENSE file.4+5 package gin6 7 import (8 "log"74 unmodified linesmodified:mode.go+4 added
1+// Copyright 2014 Manu Martinez-Almeida. All rights reserved.2+// Use of this source code is governed by a MIT style3+// license that can be found in the LICENSE file.4+5 package gin6 7 import (8 "os"38 unmodified linesmodified:recovery_test.go+4 added
1+// Copyright 2014 Manu Martinez-Almeida. All rights reserved.2+// Use of this source code is governed by a MIT style3+// license that can be found in the LICENSE file.4+5 package gin6 7 import (8 "bytes"48 unmodified linesmodified:recovery.go+4 added
1+// Copyright 2014 Manu Martinez-Almeida. All rights reserved.2+// Use of this source code is governed by a MIT style3+// license that can be found in the LICENSE file.4+5 package gin6 7 import (8 "bytes"90 unmodified linesmodified:response_writer.go+34 added-1 removed
1+// Copyright 2014 Manu Martinez-Almeida. All rights reserved.2+// Use of this source code is governed by a MIT style3+// license that can be found in the LICENSE file.4+5 package gin6 7 import (8+ "bufio"9+ "errors"10 "log"11+ "net"12 "net/http"13 )14 15 type (16 ResponseWriter interface {17 http.ResponseWriter18+ http.Hijacker19+ http.Flusher20+ http.CloseNotifier21+22 Status() int23 Written() bool24 WriteHeaderNow()25 }11 unmodified lines37 w.written = false38 }39 40 func (w *responseWriter) WriteHeader(code int) {30- if code != 0 {41+ if code > 0 {42 w.status = code43 if w.written {44 log.Println("[GIN] WARNING. Headers were already written!")45 }18 unmodified lines64 65 func (w *responseWriter) Written() bool {66 return w.written67 }68+69+// Implements the http.Hijacker interface70+func (w *responseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {71+ hijacker, ok := w.ResponseWriter.(http.Hijacker)72+ if !ok {73+ return nil, nil, errors.New("the ResponseWriter doesn't support the Hijacker interface")74+ }75+ return hijacker.Hijack()76+}77+78+// Implements the http.CloseNotify interface79+func (w *responseWriter) CloseNotify() <-chan bool {80+ return w.ResponseWriter.(http.CloseNotifier).CloseNotify()81+}82+83+// Implements the http.Flush interface84+func (w *responseWriter) Flush() {85+ flusher, ok := w.ResponseWriter.(http.Flusher)86+ if ok {87+ flusher.Flush()88+ }89+}modified:utils.go+4 added
1+// Copyright 2014 Manu Martinez-Almeida. All rights reserved.2+// Use of this source code is governed by a MIT style3+// license that can be found in the LICENSE file.4+5 package gin6 7 import (8 "encoding/xml"42 unmodified lines