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
2 changes: 1 addition & 1 deletion examples/shipping/booking/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ type errorer interface {

// encode errors from business-logic
func encodeError(_ context.Context, err error, w http.ResponseWriter) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
switch err {
case cargo.ErrUnknown:
w.WriteHeader(http.StatusNotFound)
Expand All @@ -187,7 +188,6 @@ func encodeError(_ context.Context, err error, w http.ResponseWriter) {
default:
w.WriteHeader(http.StatusInternalServerError)
}
w.Header().Set("Content-Type", "application/json; charset=utf-8")
json.NewEncoder(w).Encode(map[string]interface{}{
"error": err.Error(),
})
Expand Down
2 changes: 1 addition & 1 deletion examples/shipping/handling/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ type errorer interface {

// encode errors from business-logic
func encodeError(_ context.Context, err error, w http.ResponseWriter) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
switch err {
case cargo.ErrUnknown:
w.WriteHeader(http.StatusNotFound)
Expand All @@ -93,7 +94,6 @@ func encodeError(_ context.Context, err error, w http.ResponseWriter) {
default:
w.WriteHeader(http.StatusInternalServerError)
}
w.Header().Set("Content-Type", "application/json; charset=utf-8")
json.NewEncoder(w).Encode(map[string]interface{}{
"error": err.Error(),
})
Expand Down
2 changes: 1 addition & 1 deletion examples/shipping/tracking/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type errorer interface {

// encode errors from business-logic
func encodeError(_ context.Context, err error, w http.ResponseWriter) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
switch err {
case cargo.ErrUnknown:
w.WriteHeader(http.StatusNotFound)
Expand All @@ -67,7 +68,6 @@ func encodeError(_ context.Context, err error, w http.ResponseWriter) {
default:
w.WriteHeader(http.StatusInternalServerError)
}
w.Header().Set("Content-Type", "application/json; charset=utf-8")
json.NewEncoder(w).Encode(map[string]interface{}{
"error": err.Error(),
})
Expand Down