[There was a discussion about having the ability to define multiple success status. As it was proposed in discussion and it seemed to possibly be forgotten, I'll add this here as an issue.]
It's easy to specify multiple error statuses with u.SetExpectedErrors(...), and I can override the "success" status with nethttp.SuccessStatus(http.StatusCreated) when creating the handler. But: my API needs to return either 200 or 201 status based on some logic, with essentially the same JSON response.
I cannot find a way to do that nicely: I don't want to override the whole response serialization, and I don't think treating 200 or 201 as an "error" is the right approach. Any ideas?
[There was a discussion about having the ability to define multiple success status. As it was proposed in discussion and it seemed to possibly be forgotten, I'll add this here as an issue.]
It's easy to specify multiple error statuses with
u.SetExpectedErrors(...)
, and I can override the "success" status withnethttp.SuccessStatus(http.StatusCreated)
when creating the handler. But: my API needs to return either 200 or 201 status based on some logic, with essentially the same JSON response.I cannot find a way to do that nicely: I don't want to override the whole response serialization, and I don't think treating 200 or 201 as an "error" is the right approach. Any ideas?
Originally posted by @haimgel in https://github.com/swaggest/rest/discussions/153