1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-23 21:07:03 +00:00

touches before release

Former-commit-id: c6539320214e9120a801b2a3c3c8e9867dfb2ed7
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-07-22 04:32:54 +03:00
parent ac86d687c3
commit bb1a93d7fd
11 changed files with 59 additions and 4915 deletions

View File

@@ -658,8 +658,9 @@ type Context interface {
//
// It's mostly used internally on core/router/fs.go and context methods.
WriteNotModified()
// WriteWithExpiration like Write but it sends with an expiration datetime
// which is refreshed every package-level `StaticCacheDuration` field.
// WriteWithExpiration works like `Write` but it will check if a resource is modified,
// based on the "modtime" input argument,
// otherwise sends a 304 status code in order to let the client-side render the cached content.
WriteWithExpiration(body []byte, modtime time.Time) (int, error)
// StreamWriter registers the given stream writer for populating
// response body.
@@ -1672,10 +1673,10 @@ type (
}
// ReferrerType is the goreferrer enum for a referrer type (indirect, direct, email, search, social).
ReferrerType int
ReferrerType = goreferrer.ReferrerType
// ReferrerGoogleSearchType is the goreferrer enum for a google search type (organic, adwords).
ReferrerGoogleSearchType int
ReferrerGoogleSearchType = goreferrer.GoogleSearchType
)
// Contains the available values of the goreferrer enums.
@@ -1692,14 +1693,6 @@ const (
ReferrerGoogleAdwords
)
func (gs ReferrerGoogleSearchType) String() string {
return goreferrer.GoogleSearchType(gs).String()
}
func (r ReferrerType) String() string {
return goreferrer.ReferrerType(r).String()
}
// unnecessary but good to know the default values upfront.
var emptyReferrer = Referrer{Type: ReferrerInvalid, GoogleType: ReferrerNotGoogleSearch}
@@ -2584,8 +2577,9 @@ func (ctx *context) WriteNotModified() {
ctx.StatusCode(http.StatusNotModified)
}
// WriteWithExpiration like Write but it sends with an expiration datetime
// which is refreshed every package-level `StaticCacheDuration` field.
// WriteWithExpiration works like `Write` but it will check if a resource is modified,
// based on the "modtime" input argument,
// otherwise sends a 304 status code in order to let the client-side render the cached content.
func (ctx *context) WriteWithExpiration(body []byte, modtime time.Time) (int, error) {
if modified, err := ctx.CheckIfModifiedSince(modtime); !modified && err == nil {
ctx.WriteNotModified()