sdk-go icon indicating copy to clipboard operation
sdk-go copied to clipboard

HTTP error response details are not being shown

Open i514015 opened this issue 3 years ago • 4 comments

When getting an error response message, the return message is not being shown.

When this is returned in response to a 404 error return cloudevents.NewHTTPResult(http.StatusNotFound, "Failed to find a target for event and tenant header") it would be expected that "Failed to find a target for event and tenant header" would be shown in the response, but it is not.

response:

  • upload completely sent off: 114 out of 114 bytes < HTTP/1.1 404 Not Found < Date: Thu, 19 Nov 2020 16:42:08 GMT < Content-Length: 0 <
  • Connection #0 to host localhost left intact
  • Closing connection 0

i514015 avatar Nov 19 '20 16:11 i514015

I wonder, where would you write these error message? In the body, replying back with a text/plain?

slinkydeveloper avatar Nov 20 '20 11:11 slinkydeveloper

I would suggest a published response payload format, with the content payload matching the request format. Here's a JSON response body example: {"message": "error details"}

i514015 avatar Nov 24 '20 18:11 i514015

I recall we vaguely already discussed about that, @n3wscott @antoineco do you remember something about it?

slinkydeveloper avatar Nov 25 '20 07:11 slinkydeveloper

Yes, and still don't understand the current API.

I believe the message should be removed from that function since it's unused, and unlikely to be used if I understood the comments from #514 correctly.

antoineco avatar Nov 25 '20 07:11 antoineco