Skip to content

Commit

Permalink
fix: no message body reponsed when the query returns no content
Browse files Browse the repository at this point in the history
  • Loading branch information
junghao committed Jul 9, 2024
1 parent 8e26aa6 commit d3e86bb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/fdsn-ws/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,11 @@ func fdsnErrorHandler(err error, h http.Header, b *bytes.Buffer, nounce string)
default:
}

msg := fmt.Sprintf(FDSN_ERR_FORMAT, e.Code, http.StatusText(e.Code), e.Err, e.url, e.timestamp.Format(time.RFC3339), ver)
b.WriteString(msg)
// "no content" can't have a http body
if e.Code != http.StatusNoContent && e.Code != http.StatusNotFound {
msg := fmt.Sprintf(FDSN_ERR_FORMAT, e.Code, http.StatusText(e.Code), e.Err, e.url, e.timestamp.Format(time.RFC3339), ver)
b.WriteString(msg)
}
return nil
}

Expand Down

0 comments on commit d3e86bb

Please sign in to comment.