Skip to content

Commit

Permalink
patch: mocktr181 - adding missing statusCode and update content type
Browse files Browse the repository at this point in the history
- keep contenttype consistent with other wrp.handlers
- include a `statusCode` for bad mocktr181 cmds
  • Loading branch information
denopink committed Jul 31, 2024
1 parent 850efb6 commit dee53b4
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 dee53b4

Please sign in to comment.