Skip to content

Commit

Permalink
patch: update auth wrphandler to be webpa compliant
Browse files Browse the repository at this point in the history
- if we want webpa to use the device response status code, the device has to put the status code in its payload as a json https://github.com/xmidt-org/tr1d1um/blob/a8744affcbfa79ef19d018585a93c31843e0e7b2/translation/transport.go#L214-L216
  • Loading branch information
denopink committed Jun 18, 2024
1 parent 67511c7 commit c934a5f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/wrphandlers/auth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ func (h Handler) HandleWrp(msg wrp.Message) error {
response := msg
response.Destination = msg.Source
response.Source = h.source
response.ContentType = "text/plain"
response.Payload = []byte(fmt.Sprintf("Partner(s) '%s' not allowed. Allowed: '%s'", got, want))
response.ContentType = "application/json"

code := int64(statusCode)
response.Status = &code
response.Payload = []byte(fmt.Sprintf(`{statusCode: %d, message:"Partner(s) '%s' not allowed. Allowed: '%s'"}`, code, got, want))

sendErr := h.egress.HandleWrp(response)

Expand Down

0 comments on commit c934a5f

Please sign in to comment.