File tree 4 files changed +4
-11
lines changed
4 files changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -332,7 +332,6 @@ func TestBindbindData(t *testing.T) {
332
332
333
333
func TestBindParam (t * testing.T ) {
334
334
e := New ()
335
- * e .maxParam = 2
336
335
req := httptest .NewRequest (GET , "/" , nil )
337
336
rec := httptest .NewRecorder ()
338
337
c := e .NewContext (req , rec )
@@ -363,7 +362,6 @@ func TestBindParam(t *testing.T) {
363
362
// Bind something with param and post data payload
364
363
body := bytes .NewBufferString (`{ "name": "Jon Snow" }` )
365
364
e2 := New ()
366
- * e2 .maxParam = 2
367
365
req2 := httptest .NewRequest (POST , "/" , body )
368
366
req2 .Header .Set (HeaderContentType , MIMEApplicationJSON )
369
367
Original file line number Diff line number Diff line change @@ -310,17 +310,15 @@ func (c *context) ParamNames() []string {
310
310
311
311
func (c * context ) SetParamNames (names ... string ) {
312
312
c .pnames = names
313
+ * c .echo .maxParam = len (names )
313
314
}
314
315
315
316
func (c * context ) ParamValues () []string {
316
317
return c .pvalues [:len (c .pnames )]
317
318
}
318
319
319
320
func (c * context ) SetParamValues (values ... string ) {
320
- // NOTE: Don't just set c.pvalues = values, because it has to have length c.echo.maxParam at all times
321
- for i , val := range values {
322
- c .pvalues [i ] = val
323
- }
321
+ c .pvalues = values
324
322
}
325
323
326
324
func (c * context ) QueryParam (name string ) string {
Original file line number Diff line number Diff line change @@ -93,7 +93,6 @@ func (responseWriterErr) WriteHeader(statusCode int) {
93
93
94
94
func TestContext (t * testing.T ) {
95
95
e := New ()
96
- * e .maxParam = 1
97
96
req := httptest .NewRequest (http .MethodPost , "/" , strings .NewReader (userJSON ))
98
97
rec := httptest .NewRecorder ()
99
98
c := e .NewContext (req , rec ).(* context )
@@ -472,7 +471,6 @@ func TestContextPath(t *testing.T) {
472
471
473
472
func TestContextPathParam (t * testing.T ) {
474
473
e := New ()
475
- * e .maxParam = 2
476
474
req := httptest .NewRequest (http .MethodGet , "/" , nil )
477
475
c := e .NewContext (req , nil )
478
476
@@ -491,7 +489,8 @@ func TestContextPathParam(t *testing.T) {
491
489
492
490
func TestContextGetAndSetParam (t * testing.T ) {
493
491
e := New ()
494
- * e .maxParam = 2
492
+ r := e .Router ()
493
+ r .Add (http .MethodGet , "/:foo" , func (Context ) error { return nil })
495
494
req := httptest .NewRequest (http .MethodGet , "/:foo" , nil )
496
495
c := e .NewContext (req , nil )
497
496
c .SetParamNames ("foo" )
Original file line number Diff line number Diff line change @@ -60,8 +60,6 @@ func TestJWTRace(t *testing.T) {
60
60
61
61
func TestJWT (t * testing.T ) {
62
62
e := echo .New ()
63
- r := e .Router ()
64
- r .Add ("GET" , "/:jwt" , func (echo.Context ) error { return nil })
65
63
handler := func (c echo.Context ) error {
66
64
return c .String (http .StatusOK , "test" )
67
65
}
You can’t perform that action at this time.
0 commit comments