update response to correctly carry headers through (#384)

* update response to correctly carry headers through
This commit is contained in:
Naaman Curtis 2021-01-11 00:05:51 +00:00 committed by GitHub
parent 8c49ce396c
commit b16d7c8aac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -53,6 +53,15 @@ impl Response {
Self { extensions, ..self }
}
/// Set the http headers of the response.
#[must_use]
pub fn http_headers(self, http_headers: HeaderMap<String>) -> Self {
Self {
http_headers,
..self
}
}
/// Set the cache control of the response.
#[must_use]
pub fn cache_control(self, cache_control: CacheControl) -> Self {

View File

@ -478,6 +478,7 @@ where
Err(e) => Response::from_errors(vec![e]),
}
.extensions(extensions)
.http_headers(std::mem::take(&mut *env.http_headers.lock()))
}
/// Execute a GraphQL query.