Skip to content

Commit

Permalink
Merge pull request #255 from GeoNet/empty-fix
Browse files Browse the repository at this point in the history
fix: no message body reponsed when the query returns no content
  • Loading branch information
sue-h-gns authored Jul 9, 2024
2 parents 8e26aa6 + d3e86bb commit 5215dac
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 5215dac

Please sign in to comment.