Introduced `lol.Tracer` for function entry/exit logging across various packages. This improves traceability and debugging of function executions while preserving existing behavior. Removed unused files `doc.go` and `nothing.go` to clean up the repository.
30 lines
692 B
Go
30 lines
692 B
Go
package openapi
|
|
|
|
import (
|
|
"net/http"
|
|
"realy.lol/lol"
|
|
)
|
|
|
|
type ServeMux struct {
|
|
*http.ServeMux
|
|
}
|
|
|
|
func NewServeMux() (sm *ServeMux) {
|
|
lol.Tracer("NewServeMux")
|
|
defer func() { lol.Tracer("end NewServeMux", sm) }()
|
|
sm = &ServeMux{http.NewServeMux()}
|
|
return
|
|
}
|
|
|
|
func (c *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
lol.Tracer("ServeHTTP")
|
|
defer func() { lol.Tracer("end ServeHTTP") }()
|
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE")
|
|
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization")
|
|
if r.Method == http.MethodOptions {
|
|
return
|
|
}
|
|
c.ServeMux.ServeHTTP(w, r)
|
|
}
|