@@ -1095,9 +1095,9 @@ func (*DefaultCtx) SaveFileToStorage(fileheader *multipart.FileHeader, path stri
10951095 return nil
10961096}
10971097
1098- // Secure returns whether a secure connection was established .
1098+ // Secure is an alias of [Request.Secure] .
10991099func (c * DefaultCtx ) Secure () bool {
1100- return c .Protocol () == schemeHTTPS
1100+ return c .Req (). Secure ()
11011101}
11021102
11031103// Send sets the HTTP response body without copying it.
@@ -1228,26 +1228,14 @@ func (c *DefaultCtx) setCanonical(key, val string) {
12281228 c .fasthttp .Response .Header .SetCanonical (utils .UnsafeBytes (key ), utils .UnsafeBytes (val ))
12291229}
12301230
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].
12331232func (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 ... )
12461234}
12471235
1248- // Stale is not implemented yet, pull requests are welcome!
1236+ // Stale is an alias of [Request.Stale].
12491237func (c * DefaultCtx ) Stale () bool {
1250- return ! c . Fresh ()
1238+ return c . Req (). Stale ()
12511239}
12521240
12531241// Status sets the HTTP status for the response.
@@ -1330,10 +1318,9 @@ func (c *DefaultCtx) WriteString(s string) (int, error) {
13301318 return len (s ), nil
13311319}
13321320
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].
13351322func (c * DefaultCtx ) XHR () bool {
1336- return utils . EqualFold ( c . app . getBytes ( c . Get ( HeaderXRequestedWith )), [] byte ( "xmlhttprequest" ) )
1323+ return c . Req (). XHR ( )
13371324}
13381325
13391326// configDependentPaths set paths for route recognition and prepared paths for the user,
0 commit comments