304 and 412 HTTP response statuses #145
pboguslawski
started this conversation in
General
Replies: 1 comment 1 reply
-
New version improves support for this case, please check updated example at https://github.com/swaggest/rest/blob/v0.2.44/_examples/advanced-generic/output_writer.go. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There is no status defined for HTTP 304 nor 412 in
https://github.com/swaggest/usecase/blob/master/status/status.go#L12 (*)
Any way to use
status.Wrap
to respond with 304 or 412 ifIf-None-Match
precondition fails which is required byhttps://www.rfc-editor.org/rfc/rfc7232#section-3.2
Maybe additional states (substates?) should be added to (*)?
Update:
304 should be treated as kind of "success" response, without body, so probably should not be registred with SetExpectedErrors.
Any way to specify multiple possible success responses for given interactor (200 or 204 or 304 for example)?
When using custom error stuct (wraps original error with http status code + context fields) and custom error responses it is seems possible to workaround swaggest status limitiations with something like
but this generates 304 response in openapi.json with default error response body which is wrong (there is no body in 304 responses). When defining empty response for 304 in custom MakeErrResp
final openapi.json still contains body definition and default error response content type (here
application/problem+json
) for 304There should not be body in openapi.json problaby when
MakeErrResp
getsnil
; and maybeMakeErrResp
should have separate param for defining response content type to allow one to define different error responses with different content types (no content type ifnil
like for 304).Beta Was this translation helpful? Give feedback.
All reactions