File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,18 @@ func (r *Request) WriteResponse(resp ...any) {
159159 r .Write (v .Data )
160160 return
161161 }
162+ if v , ok := instance .(outcome.HTTPSerializer ); ok {
163+ response := v .GetResponse ()
164+ r .WriteResponse (response )
165+ return
166+ }
167+ if v , ok := instance .(* outcome.HTTPSerializer ); ok {
168+ if v != nil {
169+ response := (* v ).GetResponse ()
170+ r .WriteResponse (response )
171+ return
172+ }
173+ }
162174 if v , ok := instance .(outcome.Response ); ok {
163175
164176 if v .StatusCode > 0 {
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ import (
1010 "github.com/gofiber/fiber/v2"
1111)
1212
13+ type HTTPSerializer interface {
14+ GetResponse () Response
15+ }
16+
1317type Response struct {
1418 ContentType string
1519 Data any
You can’t perform that action at this time.
0 commit comments