Add doc comments

This commit is contained in:
Maximilian Friedersdorff 2025-06-27 20:46:52 +01:00
parent 6e56cefe6f
commit eb0c264ad7
2 changed files with 5 additions and 1 deletions

View file

@ -1,3 +1,4 @@
// Middleware to add naive caching headers
package middleware
import (
@ -15,7 +16,7 @@ type ETag struct {
}
func (etag *ETag) Header() string {
return fmt.Sprintf("\"pb-%s-%s\"", etag.Name, etag.Value)
return fmt.Sprintf("\"gn-%s-%s\"", etag.Name, etag.Value)
}
func (etag *ETag) CacheControlHeader() string {

View file

@ -1,3 +1,4 @@
// Middleware to Log out requests and response status code
package middleware
import (
@ -7,6 +8,7 @@ import (
"forgejo.gwairfelin.com/max/gonotes/internal/conf"
)
// Response writer that store the status code for logging
type loggingResponseWriter struct {
http.ResponseWriter
statusCode int
@ -21,6 +23,7 @@ func (w *loggingResponseWriter) WriteHeader(code int) {
w.ResponseWriter.WriteHeader(code)
}
// Middleware to log out requests and response status code
func LoggingMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
lwr := NewLoggingResponseWriter(w)