feat(smalltrip,problems): http handler for problems (wip)

This commit is contained in:
Guz
2025-07-04 19:15:26 -03:00
parent 094eab5333
commit 8bab404d03
2 changed files with 130 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ package problem
import (
"encoding/xml"
"fmt"
"net/http"
"slices"
)
@@ -43,6 +44,10 @@ func (p Problem) StatusCode() int {
return p.Status
}
func (p Problem) ServeHTTP(w http.ResponseWriter, r *http.Request) {
p.handler(p).ServeHTTP(w, r)
}
func WithType(t string) Option {
return func(p *Problem) {
p.Type = t