Skip to content

Commit f04b593

Browse files
Dean KarnDean Karn
authored andcommitted
accidentally left some context stuff in context.go, moved to proper 1.6 and 1.7 build files.
1 parent c33f786 commit f04b593

File tree

3 files changed

+80
-41
lines changed

3 files changed

+80
-41
lines changed

context.go

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package lars
22

33
import (
4-
"context"
54
"encoding/json"
65
"encoding/xml"
76
"io"
87
"net"
98
"net/http"
109
"strings"
11-
"time"
1210

1311
"github.com/gorilla/websocket"
1412
)
@@ -24,45 +22,6 @@ type Param struct {
2422
// It is therefore safe to read values by the index.
2523
type Params []Param
2624

27-
// Context is the context interface type
28-
type Context interface {
29-
context.Context
30-
Request() *http.Request
31-
Response() *Response
32-
WebSocket() *websocket.Conn
33-
Param(name string) string
34-
ParseForm() error
35-
ParseMultipartForm(maxMemory int64) error
36-
Set(key interface{}, value interface{})
37-
Get(key interface{}) (value interface{}, exists bool)
38-
Context() context.Context
39-
WithContext(context.Context)
40-
WithCancel() context.CancelFunc
41-
WithDeadline(time.Time) context.CancelFunc
42-
WithTimeout(time.Duration) context.CancelFunc
43-
WithValue(key interface{}, val interface{})
44-
Next()
45-
RequestStart(w http.ResponseWriter, r *http.Request)
46-
RequestEnd()
47-
ClientIP() (clientIP string)
48-
AcceptedLanguages(lowercase bool) []string
49-
HandlerName() string
50-
Stream(step func(w io.Writer) bool)
51-
JSON(int, interface{}) error
52-
JSONBytes(int, []byte) error
53-
JSONP(int, interface{}, string) error
54-
XML(int, interface{}) error
55-
XMLBytes(int, []byte) error
56-
Text(int, string) error
57-
TextBytes(int, []byte) error
58-
Attachment(r io.Reader, filename string) (err error)
59-
Inline(r io.Reader, filename string) (err error)
60-
Decode(includeFormQueryParams bool, maxMemory int64, v interface{}) (err error)
61-
BaseContext() *Ctx
62-
}
63-
64-
var _ context.Context = &Ctx{}
65-
6625
// NewContext returns a new default lars Context object.
6726
func NewContext(l *LARS) *Ctx {
6827

context_16.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,53 @@
33
package lars
44

55
import (
6+
"io"
67
"net/http"
78
"time"
89

910
"github.com/gorilla/websocket"
1011
"golang.org/x/net/context"
1112
)
1213

14+
// Context is the context interface type
15+
type Context interface {
16+
context.Context
17+
Request() *http.Request
18+
Response() *Response
19+
WebSocket() *websocket.Conn
20+
Param(name string) string
21+
ParseForm() error
22+
ParseMultipartForm(maxMemory int64) error
23+
Set(key interface{}, value interface{})
24+
Get(key interface{}) (value interface{}, exists bool)
25+
Context() context.Context
26+
WithContext(context.Context)
27+
WithCancel() context.CancelFunc
28+
WithDeadline(time.Time) context.CancelFunc
29+
WithTimeout(time.Duration) context.CancelFunc
30+
WithValue(key interface{}, val interface{})
31+
Next()
32+
RequestStart(w http.ResponseWriter, r *http.Request)
33+
RequestEnd()
34+
ClientIP() (clientIP string)
35+
AcceptedLanguages(lowercase bool) []string
36+
HandlerName() string
37+
Stream(step func(w io.Writer) bool)
38+
JSON(int, interface{}) error
39+
JSONBytes(int, []byte) error
40+
JSONP(int, interface{}, string) error
41+
XML(int, interface{}) error
42+
XMLBytes(int, []byte) error
43+
Text(int, string) error
44+
TextBytes(int, []byte) error
45+
Attachment(r io.Reader, filename string) (err error)
46+
Inline(r io.Reader, filename string) (err error)
47+
Decode(includeFormQueryParams bool, maxMemory int64, v interface{}) (err error)
48+
BaseContext() *Ctx
49+
}
50+
51+
var _ context.Context = &Ctx{}
52+
1353
// Ctx encapsulates the http request, response context
1454
type Ctx struct {
1555
netContext context.Context

context_17.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,52 @@ package lars
44

55
import (
66
"context"
7+
"io"
78
"net/http"
89
"time"
910

1011
"github.com/gorilla/websocket"
1112
)
1213

14+
// Context is the context interface type
15+
type Context interface {
16+
context.Context
17+
Request() *http.Request
18+
Response() *Response
19+
WebSocket() *websocket.Conn
20+
Param(name string) string
21+
ParseForm() error
22+
ParseMultipartForm(maxMemory int64) error
23+
Set(key interface{}, value interface{})
24+
Get(key interface{}) (value interface{}, exists bool)
25+
Context() context.Context
26+
WithContext(context.Context)
27+
WithCancel() context.CancelFunc
28+
WithDeadline(time.Time) context.CancelFunc
29+
WithTimeout(time.Duration) context.CancelFunc
30+
WithValue(key interface{}, val interface{})
31+
Next()
32+
RequestStart(w http.ResponseWriter, r *http.Request)
33+
RequestEnd()
34+
ClientIP() (clientIP string)
35+
AcceptedLanguages(lowercase bool) []string
36+
HandlerName() string
37+
Stream(step func(w io.Writer) bool)
38+
JSON(int, interface{}) error
39+
JSONBytes(int, []byte) error
40+
JSONP(int, interface{}, string) error
41+
XML(int, interface{}) error
42+
XMLBytes(int, []byte) error
43+
Text(int, string) error
44+
TextBytes(int, []byte) error
45+
Attachment(r io.Reader, filename string) (err error)
46+
Inline(r io.Reader, filename string) (err error)
47+
Decode(includeFormQueryParams bool, maxMemory int64, v interface{}) (err error)
48+
BaseContext() *Ctx
49+
}
50+
51+
var _ context.Context = &Ctx{}
52+
1353
// Ctx encapsulates the http request, response context
1454
type Ctx struct {
1555
request *http.Request

0 commit comments

Comments
 (0)