Skip to content

Commit

Permalink
Merge pull request #205 from xmidt-org/denopink/patch/standardize-moc…
Browse files Browse the repository at this point in the history
…ktr181-response

patch: mocktr181 - adding missing `statusCode` and update content type
  • Loading branch information
denopink authored Jul 31, 2024
2 parents 850efb6 + dee53b4 commit 768d15f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/wrphandlers/mocktr181/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ func (h Handler) HandleWrp(msg wrp.Message) error {
default:
// currently only get and set are implemented for existing mocktr181
statusCode = 520
payloadResponse = []byte(fmt.Sprintf(`{"message": "command %s is not support"}`, command))
payloadResponse = []byte(fmt.Sprintf(`{"message": "command %s is not support", "statusCode": %d}`, command, statusCode))
}

response := msg
response.Destination = msg.Source
response.Source = h.source
response.ContentType = "text/plain"
response.ContentType = "application/json"
response.Payload = payloadResponse

response.Status = &statusCode
Expand Down

0 comments on commit 768d15f

Please sign in to comment.