@@ -97,22 +97,22 @@ type Context interface {
97
97
Cookies () []* http.Cookie
98
98
99
99
// Get retrieves data from the context.
100
- Get (key string ) interface {}
100
+ Get (key string ) any
101
101
102
102
// Set saves data in the context.
103
- Set (key string , val interface {} )
103
+ Set (key string , val any )
104
104
105
105
// Bind binds path params, query params and the request body into provided type `i`. The default binder
106
106
// binds body based on Content-Type header.
107
- Bind (i interface {} ) error
107
+ Bind (i any ) error
108
108
109
109
// Validate validates provided `i`. It is usually called after `Context#Bind()`.
110
110
// Validator must be registered using `Echo#Validator`.
111
- Validate (i interface {} ) error
111
+ Validate (i any ) error
112
112
113
113
// Render renders a template with data and sends a text/html response with status
114
114
// code. Renderer must be registered using `Echo.Renderer`.
115
- Render (code int , name string , data interface {} ) error
115
+ Render (code int , name string , data any ) error
116
116
117
117
// HTML sends an HTTP response with status code.
118
118
HTML (code int , html string ) error
@@ -124,27 +124,27 @@ type Context interface {
124
124
String (code int , s string ) error
125
125
126
126
// JSON sends a JSON response with status code.
127
- JSON (code int , i interface {} ) error
127
+ JSON (code int , i any ) error
128
128
129
129
// JSONPretty sends a pretty-print JSON with status code.
130
- JSONPretty (code int , i interface {} , indent string ) error
130
+ JSONPretty (code int , i any , indent string ) error
131
131
132
132
// JSONBlob sends a JSON blob response with status code.
133
133
JSONBlob (code int , b []byte ) error
134
134
135
135
// JSONP sends a JSONP response with status code. It uses `callback` to construct
136
136
// the JSONP payload.
137
- JSONP (code int , callback string , i interface {} ) error
137
+ JSONP (code int , callback string , i any ) error
138
138
139
139
// JSONPBlob sends a JSONP blob response with status code. It uses `callback`
140
140
// to construct the JSONP payload.
141
141
JSONPBlob (code int , callback string , b []byte ) error
142
142
143
143
// XML sends an XML response with status code.
144
- XML (code int , i interface {} ) error
144
+ XML (code int , i any ) error
145
145
146
146
// XMLPretty sends a pretty-print XML with status code.
147
- XMLPretty (code int , i interface {} , indent string ) error
147
+ XMLPretty (code int , i any , indent string ) error
148
148
149
149
// XMLBlob sends an XML blob response with status code.
150
150
XMLBlob (code int , b []byte ) error
@@ -430,13 +430,13 @@ func (c *context) Cookies() []*http.Cookie {
430
430
return c .request .Cookies ()
431
431
}
432
432
433
- func (c * context ) Get (key string ) interface {} {
433
+ func (c * context ) Get (key string ) any {
434
434
c .lock .RLock ()
435
435
defer c .lock .RUnlock ()
436
436
return c .store [key ]
437
437
}
438
438
439
- func (c * context ) Set (key string , val interface {} ) {
439
+ func (c * context ) Set (key string , val any ) {
440
440
c .lock .Lock ()
441
441
defer c .lock .Unlock ()
442
442
@@ -446,18 +446,18 @@ func (c *context) Set(key string, val interface{}) {
446
446
c .store [key ] = val
447
447
}
448
448
449
- func (c * context ) Bind (i interface {} ) error {
449
+ func (c * context ) Bind (i any ) error {
450
450
return c .echo .Binder .Bind (i , c )
451
451
}
452
452
453
- func (c * context ) Validate (i interface {} ) error {
453
+ func (c * context ) Validate (i any ) error {
454
454
if c .echo .Validator == nil {
455
455
return ErrValidatorNotRegistered
456
456
}
457
457
return c .echo .Validator .Validate (i )
458
458
}
459
459
460
- func (c * context ) Render (code int , name string , data interface {} ) (err error ) {
460
+ func (c * context ) Render (code int , name string , data any ) (err error ) {
461
461
if c .echo .Renderer == nil {
462
462
return ErrRendererNotRegistered
463
463
}
@@ -480,7 +480,7 @@ func (c *context) String(code int, s string) (err error) {
480
480
return c .Blob (code , MIMETextPlainCharsetUTF8 , []byte (s ))
481
481
}
482
482
483
- func (c * context ) jsonPBlob (code int , callback string , i interface {} ) (err error ) {
483
+ func (c * context ) jsonPBlob (code int , callback string , i any ) (err error ) {
484
484
indent := ""
485
485
if _ , pretty := c .QueryParams ()["pretty" ]; c .echo .Debug || pretty {
486
486
indent = defaultIndent
@@ -499,29 +499,29 @@ func (c *context) jsonPBlob(code int, callback string, i interface{}) (err error
499
499
return
500
500
}
501
501
502
- func (c * context ) json (code int , i interface {} , indent string ) error {
502
+ func (c * context ) json (code int , i any , indent string ) error {
503
503
c .writeContentType (MIMEApplicationJSON )
504
504
c .response .Status = code
505
505
return c .echo .JSONSerializer .Serialize (c , i , indent )
506
506
}
507
507
508
- func (c * context ) JSON (code int , i interface {} ) (err error ) {
508
+ func (c * context ) JSON (code int , i any ) (err error ) {
509
509
indent := ""
510
510
if _ , pretty := c .QueryParams ()["pretty" ]; c .echo .Debug || pretty {
511
511
indent = defaultIndent
512
512
}
513
513
return c .json (code , i , indent )
514
514
}
515
515
516
- func (c * context ) JSONPretty (code int , i interface {} , indent string ) (err error ) {
516
+ func (c * context ) JSONPretty (code int , i any , indent string ) (err error ) {
517
517
return c .json (code , i , indent )
518
518
}
519
519
520
520
func (c * context ) JSONBlob (code int , b []byte ) (err error ) {
521
521
return c .Blob (code , MIMEApplicationJSON , b )
522
522
}
523
523
524
- func (c * context ) JSONP (code int , callback string , i interface {} ) (err error ) {
524
+ func (c * context ) JSONP (code int , callback string , i any ) (err error ) {
525
525
return c .jsonPBlob (code , callback , i )
526
526
}
527
527
@@ -538,7 +538,7 @@ func (c *context) JSONPBlob(code int, callback string, b []byte) (err error) {
538
538
return
539
539
}
540
540
541
- func (c * context ) xml (code int , i interface {} , indent string ) (err error ) {
541
+ func (c * context ) xml (code int , i any , indent string ) (err error ) {
542
542
c .writeContentType (MIMEApplicationXMLCharsetUTF8 )
543
543
c .response .WriteHeader (code )
544
544
enc := xml .NewEncoder (c .response )
@@ -551,15 +551,15 @@ func (c *context) xml(code int, i interface{}, indent string) (err error) {
551
551
return enc .Encode (i )
552
552
}
553
553
554
- func (c * context ) XML (code int , i interface {} ) (err error ) {
554
+ func (c * context ) XML (code int , i any ) (err error ) {
555
555
indent := ""
556
556
if _ , pretty := c .QueryParams ()["pretty" ]; c .echo .Debug || pretty {
557
557
indent = defaultIndent
558
558
}
559
559
return c .xml (code , i , indent )
560
560
}
561
561
562
- func (c * context ) XMLPretty (code int , i interface {} , indent string ) (err error ) {
562
+ func (c * context ) XMLPretty (code int , i any , indent string ) (err error ) {
563
563
return c .xml (code , i , indent )
564
564
}
565
565
0 commit comments