@@ -310,8 +310,10 @@ func (ctx *Ctx) Cookie(cookie *Cookie) {
310
310
}
311
311
312
312
// Cookies is used for getting a cookie value by key
313
+ // Defaults to empty string "" if the cookie doesn't exist.
314
+ // If a default value is given, it will return that value if the cookie doesn't exist.
313
315
// Returned value is only valid within the handler. Do not store any references.
314
- // Make copies or use the Immutable setting instead .
316
+ // Make copies or use the Immutable setting to use the value outside the Handler .
315
317
func (ctx * Ctx ) Cookies (key string , defaultValue ... string ) string {
316
318
return defaultString (getString (ctx .Fasthttp .Request .Header .Cookie (key )), defaultValue )
317
319
}
@@ -628,7 +630,10 @@ func (ctx *Ctx) OriginalURL() string {
628
630
}
629
631
630
632
// Params is used to get the route parameters.
631
- // Defaults to empty string "", if the param doesn't exist.
633
+ // Defaults to empty string "" if the param doesn't exist.
634
+ // If a default value is given, it will return that value if the param doesn't exist.
635
+ // Returned value is only valid within the handler. Do not store any references.
636
+ // Make copies or use the Immutable setting to use the value outside the Handler.
632
637
func (ctx * Ctx ) Params (key string , defaultValue ... string ) string {
633
638
for i := range ctx .route .routeParams {
634
639
if len (key ) != len (ctx .route .routeParams [i ]) {
@@ -685,8 +690,10 @@ func (ctx *Ctx) Protocol() string {
685
690
}
686
691
687
692
// Query returns the query string parameter in the url.
693
+ // Defaults to empty string "" if the query doesn't exist.
694
+ // If a default value is given, it will return that value if the query doesn't exist.
688
695
// Returned value is only valid within the handler. Do not store any references.
689
- // Make copies or use the Immutable setting instead .
696
+ // Make copies or use the Immutable setting to use the value outside the Handler .
690
697
func (ctx * Ctx ) Query (key string , defaultValue ... string ) string {
691
698
return defaultString (getString (ctx .Fasthttp .QueryArgs ().Peek (key )), defaultValue )
692
699
}
0 commit comments