Bump actix version

This commit is contained in:
asonix
2021-04-17 12:36:47 -05:00
parent 45ba2e5c26
commit 80bc838073
4 changed files with 96 additions and 85 deletions
+10 -6
View File
@@ -1,8 +1,9 @@
use activitystreams::{error::DomainError, url::ParseError};
use actix_web::{
dev::Body,
error::{BlockingError, ResponseError},
http::StatusCode,
HttpResponse,
BaseHttpResponse,
};
use http_signature_normalization_actix::PrepareSignError;
use log::error;
@@ -129,12 +130,15 @@ impl ResponseError for MyError {
}
}
fn error_response(&self) -> HttpResponse {
HttpResponse::build(self.status_code())
fn error_response(&self) -> BaseHttpResponse<Body> {
BaseHttpResponse::build(self.status_code())
.insert_header(("Content-Type", "application/activity+json"))
.json(&serde_json::json!({
"error": self.to_string(),
}))
.body(
serde_json::to_string(&serde_json::json!({
"error": self.to_string(),
}))
.unwrap_or("{}".to_string()),
)
}
}
+4 -4
View File
@@ -1,8 +1,8 @@
use actix_web::{
dev::{Payload, Service, ServiceRequest, Transform},
dev::{Body, Payload, Service, ServiceRequest, Transform},
http::{Method, StatusCode},
web::BytesMut,
HttpMessage, HttpResponse, ResponseError,
BaseHttpResponse, HttpMessage, ResponseError,
};
use futures::{
future::{ok, LocalBoxFuture, Ready, TryFutureExt},
@@ -27,8 +27,8 @@ impl ResponseError for DebugError {
StatusCode::BAD_REQUEST
}
fn error_response(&self) -> HttpResponse {
HttpResponse::new(self.status_code())
fn error_response(&self) -> BaseHttpResponse<Body> {
BaseHttpResponse::new(self.status_code())
}
}