MCPcopy Create free account
hub / github.com/kataras/iris / WriteNotModified

Method WriteNotModified

context/context.go:3495–3508  ·  view source on GitHub ↗

WriteNotModified sends a 304 "Not Modified" status code to the client, it makes sure that the content type, the content length headers and any "ETag" are removed before the response sent. It's mostly used internally on core/router/fs.go and context methods.

()

Source from the content-addressed store, hash-verified

3493//
3494// It's mostly used internally on core/router/fs.go and context methods.
3495func (ctx *Context) WriteNotModified() {
3496 // RFC 7232 section 4.1:
3497 // a sender SHOULD NOT generate representation metadata other than the
3498 // above listed fields unless said metadata exists for the purpose of
3499 // guiding cache updates (e.g.," Last-Modified" might be useful if the
3500 // response does not have an ETag field).
3501 h := ctx.ResponseWriter().Header()
3502 delete(h, ContentTypeHeaderKey)
3503 delete(h, ContentLengthHeaderKey)
3504 if h.Get(ETagHeaderKey) != "" {
3505 delete(h, LastModifiedHeaderKey)
3506 }
3507 ctx.StatusCode(http.StatusNotModified)
3508}
3509
3510// WriteWithExpiration works like `Write` but it will check if a resource is modified,
3511// based on the "modtime" input argument,

Callers 3

WriteWithExpirationMethod · 0.95
browser.goFile · 0.80
FileServerFunction · 0.80

Calls 4

ResponseWriterMethod · 0.95
StatusCodeMethod · 0.95
GetMethod · 0.65
HeaderMethod · 0.45

Tested by

no test coverage detected