HttpPayloadError
in server logic gets turned into a 400
#1438
Labels
enhancement
New feature or request
Milestone
Similar to #1256, but not a regression from 0.17: it appears to have been here all along.
Consider this case: a smithy4s server wrapping a smithy4s client (doesn't have to be the same Service, but it can be, e.g. in a proxy scenario).
Now here's what may happen:
HttpPayloadError
.HttpPayloadError
).This appears incorrect: the error is clearly not a problem of the ultimate caller of the service: ideally, the smithy4s server here would return a 500 (the serialization of which is up for debate). At the moment, it makes it seem like the client has made a mistake in its request. This may be very difficult to debug.
Reproduction: this prints a 400 response with a JSON body. I would expect it to fail on IO level.
I believe this is due to this line:
smithy4s/modules/core/src/smithy4s/http/HttpUnaryServerCodecs.scala
Line 201 in 3233108
and this function is later called here:
smithy4s/modules/core/src/smithy4s/server/UnaryServerEndpoint.scala
Line 37 in 3233108
HPEs are special-cased in the first snippet, as far as I understand it's because they're normally raised in the request decoding logic. However, this is clearly not a request decoding problem, so we should probably circumvent that code path.
I'm not sure if this is a server problem or a client problem:
The text was updated successfully, but these errors were encountered: