@@ -1095,9 +1095,9 @@ func (*DefaultCtx) SaveFileToStorage(fileheader *multipart.FileHeader, path stri
1095
1095
return nil
1096
1096
}
1097
1097
1098
- // Secure returns whether a secure connection was established .
1098
+ // Secure is an alias of [Request.Secure] .
1099
1099
func (c * DefaultCtx ) Secure () bool {
1100
- return c .Protocol () == schemeHTTPS
1100
+ return c .Req (). Secure ()
1101
1101
}
1102
1102
1103
1103
// Send sets the HTTP response body without copying it.
@@ -1228,26 +1228,14 @@ func (c *DefaultCtx) setCanonical(key, val string) {
1228
1228
c .fasthttp .Response .Header .SetCanonical (utils .UnsafeBytes (key ), utils .UnsafeBytes (val ))
1229
1229
}
1230
1230
1231
- // Subdomains returns a string slice of subdomains in the domain name of the request.
1232
- // The subdomain offset, which defaults to 2, is used for determining the beginning of the subdomain segments.
1231
+ // Subdomains is an alias of [Request.Subdomains].
1233
1232
func (c * DefaultCtx ) Subdomains (offset ... int ) []string {
1234
- o := 2
1235
- if len (offset ) > 0 {
1236
- o = offset [0 ]
1237
- }
1238
- subdomains := strings .Split (c .Host (), "." )
1239
- l := len (subdomains ) - o
1240
- // Check index to avoid slice bounds out of range panic
1241
- if l < 0 {
1242
- l = len (subdomains )
1243
- }
1244
- subdomains = subdomains [:l ]
1245
- return subdomains
1233
+ return c .Req ().Subdomains (offset ... )
1246
1234
}
1247
1235
1248
- // Stale is not implemented yet, pull requests are welcome!
1236
+ // Stale is an alias of [Request.Stale].
1249
1237
func (c * DefaultCtx ) Stale () bool {
1250
- return ! c . Fresh ()
1238
+ return c . Req (). Stale ()
1251
1239
}
1252
1240
1253
1241
// Status sets the HTTP status for the response.
@@ -1330,10 +1318,9 @@ func (c *DefaultCtx) WriteString(s string) (int, error) {
1330
1318
return len (s ), nil
1331
1319
}
1332
1320
1333
- // XHR returns a Boolean property, that is true, if the request's X-Requested-With header field is XMLHttpRequest,
1334
- // indicating that the request was issued by a client library (such as jQuery).
1321
+ // XHR is an alias of [Request.XHR].
1335
1322
func (c * DefaultCtx ) XHR () bool {
1336
- return utils . EqualFold ( c . app . getBytes ( c . Get ( HeaderXRequestedWith )), [] byte ( "xmlhttprequest" ) )
1323
+ return c . Req (). XHR ( )
1337
1324
}
1338
1325
1339
1326
// configDependentPaths set paths for route recognition and prepared paths for the user,
0 commit comments