diff --git a/impl/pkg/server/pkarr.go b/impl/pkg/server/pkarr.go index 98f1d293..ac8d200e 100644 --- a/impl/pkg/server/pkarr.go +++ b/impl/pkg/server/pkarr.go @@ -120,5 +120,5 @@ func (r *PKARRRouter) PutRecord(c *gin.Context) { return } - Respond(c, nil, http.StatusOK) + ResponseStatus(c, http.StatusOK) } diff --git a/impl/pkg/server/util.go b/impl/pkg/server/util.go index 8a4d1649..fef9a26c 100644 --- a/impl/pkg/server/util.go +++ b/impl/pkg/server/util.go @@ -65,10 +65,15 @@ func Respond(c *gin.Context, data any, statusCode int) { c.PureJSON(statusCode, data) } +// ResponseStatus sends a response with a status code and no body. +func ResponseStatus(c *gin.Context, statusCode int) { + c.Status(statusCode) +} + // RespondBytes sends a byte array to the client. func RespondBytes(c *gin.Context, data []byte, statusCode int) { // if there's no payload to marshal, set the status code of the response and return - if statusCode == http.StatusNoContent { + if statusCode == http.StatusNoContent || data == nil { c.Status(statusCode) return }