1
0
Fork 0
mirror of https://gitlab.com/msrd0/gotham-restful.git synced 2025-04-20 23:07:01 +00:00

add headers to the response (#27)

This commit is contained in:
Dominic 2021-01-14 18:37:51 +01:00
parent 3600a115d0
commit 44f3c9fe84
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
9 changed files with 48 additions and 12 deletions

View file

@ -196,11 +196,11 @@ impl ErrorVariant {
quote!(#from_field.into_response_error())
},
(Some(_), Some(_)) => return Err(Error::new(ident.span(), "When #[from] is used, #[status] must not be used!")),
(None, Some(status)) => quote!(Ok(#krate::Response {
status: { #status }.into(),
body: #krate::gotham::hyper::Body::empty(),
mime: None
})),
(None, Some(status)) => quote!(Ok(#krate::Response::new(
{ #status }.into(),
#krate::gotham::hyper::Body::empty(),
None
))),
(None, None) => return Err(Error::new(ident.span(), "Missing #[status(code)] for this variant"))
};