@@ -11,7 +11,7 @@ import (
11
11
// TestContext_GetParam tests the GetParam function
12
12
func TestContext_GetParam (t * testing.T ) {
13
13
req := httptest .NewRequest (http .MethodGet , "/test?param=value" , nil )
14
- ctx := & Context {request : req }
14
+ ctx := & ServerContext {request : req }
15
15
16
16
value , err := ctx .GetParam ("param" , QueryParam )
17
17
if err != nil {
@@ -26,7 +26,7 @@ func TestContext_GetParam(t *testing.T) {
26
26
func TestContext_GetBody (t * testing.T ) {
27
27
body := "test body"
28
28
req := httptest .NewRequest (http .MethodPost , "/test" , strings .NewReader (body ))
29
- ctx := & Context {request : req }
29
+ ctx := & ServerContext {request : req }
30
30
31
31
r , err := ctx .GetBody ()
32
32
if err != nil {
@@ -43,7 +43,7 @@ func TestContext_GetBody(t *testing.T) {
43
43
func TestContext_GetHeader (t * testing.T ) {
44
44
req := httptest .NewRequest (http .MethodGet , "/test" , nil )
45
45
req .Header .Set ("X-Test-Header" , "test-value" )
46
- ctx := & Context {request : req }
46
+ ctx := & ServerContext {request : req }
47
47
48
48
value := ctx .GetHeader ("X-Test-Header" )
49
49
if value != "test-value" {
@@ -55,7 +55,7 @@ func TestContext_GetHeader(t *testing.T) {
55
55
func TestContext_InHeaders (t * testing.T ) {
56
56
req := httptest .NewRequest (http .MethodGet , "/test" , nil )
57
57
req .Header .Set ("X-Test-Header" , "test-value" )
58
- ctx := & Context {request : req }
58
+ ctx := & ServerContext {request : req }
59
59
60
60
headers := ctx .InHeaders ()
61
61
if headers .Get ("X-Test-Header" ) != "test-value" {
@@ -66,7 +66,7 @@ func TestContext_InHeaders(t *testing.T) {
66
66
// TestContext_GetMethod tests the GetMethod function
67
67
func TestContext_GetMethod (t * testing.T ) {
68
68
req := httptest .NewRequest (http .MethodPost , "/test" , nil )
69
- ctx := & Context {request : req }
69
+ ctx := & ServerContext {request : req }
70
70
71
71
method := ctx .GetMethod ()
72
72
if method != http .MethodPost {
@@ -77,7 +77,7 @@ func TestContext_GetMethod(t *testing.T) {
77
77
// TestContext_GetURL tests the GetURL function
78
78
func TestContext_GetURL (t * testing.T ) {
79
79
req := httptest .NewRequest (http .MethodGet , "/test" , nil )
80
- ctx := & Context {request : req }
80
+ ctx := & ServerContext {request : req }
81
81
82
82
url := ctx .GetURL ()
83
83
if url != "/test" {
@@ -88,7 +88,7 @@ func TestContext_GetURL(t *testing.T) {
88
88
// TestContext_GetRequest tests the GetRequest function
89
89
func TestContext_GetRequest (t * testing.T ) {
90
90
req := httptest .NewRequest (http .MethodGet , "/test" , nil )
91
- ctx := & Context {request : req }
91
+ ctx := & ServerContext {request : req }
92
92
93
93
request := ctx .GetRequest ()
94
94
if request != req {
@@ -101,7 +101,7 @@ func TestContext_Read(t *testing.T) {
101
101
body := `{"key":"value"}`
102
102
req := httptest .NewRequest (http .MethodPost , "/test" , strings .NewReader (body ))
103
103
req .Header .Set (ContentTypeHeader , "application/json" )
104
- ctx := & Context {request : req }
104
+ ctx := & ServerContext {request : req }
105
105
106
106
var obj map [string ]string
107
107
err := ctx .Read (& obj )
@@ -116,7 +116,7 @@ func TestContext_Read(t *testing.T) {
116
116
// TestContext_Write tests the Write function
117
117
func TestContext_Write (t * testing.T ) {
118
118
rec := httptest .NewRecorder ()
119
- ctx := & Context {response : rec }
119
+ ctx := & ServerContext {response : rec }
120
120
121
121
data := map [string ]string {"key" : "value" }
122
122
err := ctx .Write (data , "application/json" )
@@ -131,7 +131,7 @@ func TestContext_Write(t *testing.T) {
131
131
// TestContext_WriteData tests the WriteData function
132
132
func TestContext_WriteData (t * testing.T ) {
133
133
rec := httptest .NewRecorder ()
134
- ctx := & Context {response : rec }
134
+ ctx := & ServerContext {response : rec }
135
135
136
136
data := []byte ("test data" )
137
137
n , err := ctx .WriteData (data )
@@ -149,7 +149,7 @@ func TestContext_WriteData(t *testing.T) {
149
149
// TestContext_WriteString tests the WriteString function
150
150
func TestContext_WriteString (t * testing.T ) {
151
151
rec := httptest .NewRecorder ()
152
- ctx := & Context {response : rec }
152
+ ctx := & ServerContext {response : rec }
153
153
154
154
data := "test string"
155
155
ctx .WriteString (data )
@@ -161,7 +161,7 @@ func TestContext_WriteString(t *testing.T) {
161
161
// TestContext_SetHeader tests the SetHeader function
162
162
func TestContext_SetHeader (t * testing.T ) {
163
163
rec := httptest .NewRecorder ()
164
- ctx := & Context {response : rec }
164
+ ctx := & ServerContext {response : rec }
165
165
166
166
ctx .SetHeader ("X-Test-Header" , "test-value" )
167
167
if rec .Header ().Get ("X-Test-Header" ) != "test-value" {
@@ -172,7 +172,7 @@ func TestContext_SetHeader(t *testing.T) {
172
172
// TestContext_SetContentType tests the SetContentType function
173
173
func TestContext_SetContentType (t * testing.T ) {
174
174
rec := httptest .NewRecorder ()
175
- ctx := & Context {response : rec }
175
+ ctx := & ServerContext {response : rec }
176
176
177
177
ctx .SetContentType ("application/json" )
178
178
if rec .Header ().Get (ContentTypeHeader ) != "application/json" {
@@ -183,7 +183,7 @@ func TestContext_SetContentType(t *testing.T) {
183
183
// TestContext_SetStatusCode tests the SetStatusCode function
184
184
func TestContext_SetStatusCode (t * testing.T ) {
185
185
rec := httptest .NewRecorder ()
186
- ctx := & Context {response : rec }
186
+ ctx := & ServerContext {response : rec }
187
187
188
188
ctx .SetStatusCode (http .StatusCreated )
189
189
if rec .Code != http .StatusCreated {
@@ -194,7 +194,7 @@ func TestContext_SetStatusCode(t *testing.T) {
194
194
// TestContext_SetCookie tests the SetCookie function
195
195
func TestContext_SetCookie (t * testing.T ) {
196
196
rec := httptest .NewRecorder ()
197
- ctx := & Context {response : rec }
197
+ ctx := & ServerContext {response : rec }
198
198
199
199
cookie := & http.Cookie {Name : "test-cookie" , Value : "test-value" }
200
200
ctx .SetCookie (cookie )
@@ -206,7 +206,7 @@ func TestContext_SetCookie(t *testing.T) {
206
206
// TestContext_WriteFrom tests the WriteFrom function
207
207
func TestContext_WriteFrom (t * testing.T ) {
208
208
rec := httptest .NewRecorder ()
209
- ctx := & Context {response : rec }
209
+ ctx := & ServerContext {response : rec }
210
210
211
211
data := "test data"
212
212
ctx .WriteFrom (strings .NewReader (data ))
@@ -218,7 +218,7 @@ func TestContext_WriteFrom(t *testing.T) {
218
218
// TestContext_HttpResWriter tests the HttpResWriter function
219
219
func TestContext_HttpResWriter (t * testing.T ) {
220
220
rec := httptest .NewRecorder ()
221
- ctx := & Context {response : rec }
221
+ ctx := & ServerContext {response : rec }
222
222
223
223
writer := ctx .HttpResWriter ()
224
224
if writer != rec {
0 commit comments