Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package builder

import (
"context"
"fmt"
"net/http"
"reflect"

Expand Down Expand Up @@ -83,7 +84,7 @@ func (b *Builder) ServeSchema(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Type", "application/json")
_, err = w.Write(data)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
fmt.Printf("failed to write response: %v\n", err)
return
}
}
Expand Down
4 changes: 2 additions & 2 deletions example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func main() {
router.Get("/redoc", func(w http.ResponseWriter, r *http.Request) {
_, err := w.Write(redocFile)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
fmt.Printf("failed to write response: %v\n", err)
return
}
})
Expand All @@ -96,7 +96,7 @@ func main() {
// embed
_, err := w.Write(indexFile)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
fmt.Printf("failed to write response: %v\n", err)
return
}

Expand Down
3 changes: 2 additions & 1 deletion response/bytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package response

import (
"context"
"fmt"
"net/http"
)

Expand All @@ -18,7 +19,7 @@ func (e *BytesEncoder) EncodeResponse(ctx context.Context, w http.ResponseWriter

_, err := w.Write(raw)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
fmt.Printf("failed to write response: %v\n", err)
return
}
}
3 changes: 2 additions & 1 deletion response/json_encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package response
import (
"context"
"encoding/json"
"fmt"
"net/http"
)

Expand All @@ -13,7 +14,7 @@ func (e *JsonEncoder) EncodeResponse(ctx context.Context, w http.ResponseWriter,

err := json.NewEncoder(w).Encode(obj)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
fmt.Printf("failed to write response: %v\n", err)
return
}

Expand Down
Loading