5.0 KiB
0.7
-
HttpRequest
does not implementStream
anymore. If you need to read request payload useHttpMessage::payload()
method.instead of
fn index(req: HttpRequest) -> impl Responder { req .from_err() .fold(...) .... }
use
.payload()
fn index(req: HttpRequest) -> impl Responder { req .payload() // <- get request payload stream .from_err() .fold(...) .... }
-
Middleware trait uses
&HttpRequest
instead of&mut HttpRequest
. -
Removed
Route::with2()
andRoute::with3()
use tuple of extractors instead.instead of
fn index(query: Query<..>, info: Json<MyStruct) -> impl Responder {}
use tuple of extractors and use
.with()
for registration:fn index((query, json): (Query<..>, Json<MyStruct)) -> impl Responder {}
-
Handler::handle()
uses&self
instead of&mut self
-
Handler::handle()
accepts reference toHttpRequest<_>
instead of value -
Removed deprecated
HttpServer::threads()
, use HttpServer::workers() instead. -
Renamed
client::ClientConnectorError::Connector
toclient::ClientConnectorError::Resolver
-
Route::with()
does not returnExtractorConfig
, to configure extractor useRoute::with_config()
instead of
fn main() { let app = App::new().resource("/index.html", |r| { r.method(http::Method::GET) .with(index) .limit(4096); // <- limit size of the payload }); }
use
fn main() { let app = App::new().resource("/index.html", |r| { r.method(http::Method::GET) .with_config(index, |cfg| { // <- register handler cfg.limit(4096); // <- limit size of the payload }) }); }
-
Route::with_async()
does not returnExtractorConfig
, to configure extractor useRoute::with_async_config()
0.6
-
Path<T>
extractor returnErrorNotFound
on failure instead ofErrorBadRequest
-
ws::Message::Close
now includes optional close reason.ws::CloseCode::Status
andws::CloseCode::Empty
have been removed. -
HttpServer::threads()
renamed toHttpServer::workers()
. -
HttpServer::start_ssl()
andHttpServer::start_tls()
deprecated. UseHttpServer::bind_ssl()
andHttpServer::bind_tls()
instead. -
HttpRequest::extensions()
returns read only reference to the request's ExtensionHttpRequest::extensions_mut()
returns mutable reference. -
Instead of
use actix_web::middleware::{ CookieSessionBackend, CookieSessionError, RequestSession, Session, SessionBackend, SessionImpl, SessionStorage};
use
actix_web::middleware::session
use actix_web::middleware::session{CookieSessionBackend, CookieSessionError, RequestSession, Session, SessionBackend, SessionImpl, SessionStorage};
-
FromRequest::from_request()
accepts mutable reference to a request -
FromRequest::Result
has to implementInto<Reply<Self>>
-
Responder::respond_to()
is generic overS
-
Use
Query
extractor instead of HttpRequest::query()`.fn index(q: Query<HashMap<String, String>>) -> Result<..> { ... }
or
let q = Query::<HashMap<String, String>>::extract(req);
-
Websocket operations are implemented as
WsWriter
trait. you need to useuse actix_web::ws::WsWriter
0.5
-
HttpResponseBuilder::body()
,.finish()
,.json()
methods returnHttpResponse
instead ofResult<HttpResponse>
-
actix_web::Method
,actix_web::StatusCode
,actix_web::Version
moved toactix_web::http
module -
actix_web::header
moved toactix_web::http::header
-
NormalizePath
moved toactix_web::http
module -
HttpServer
moved toactix_web::server
, added newactix_web::server::new()
function, shortcut foractix_web::server::HttpServer::new()
-
DefaultHeaders
middleware does not use separate builder, all builder methods moved to type itself -
StaticFiles::new()
's show_index parameter removed, useshow_files_listing()
method instead. -
CookieSessionBackendBuilder
removed, all methods moved toCookieSessionBackend
type -
actix_web::httpcodes
module is deprecated,HttpResponse::Ok()
,HttpResponse::Found()
and otherHttpResponse::XXX()
functions should be used instead -
ClientRequestBuilder::body()
returnsResult<_, actix_web::Error>
instead ofResult<_, http::Error>
-
Application
renamed to aApp
-
actix_web::Reply
,actix_web::Resource
moved toactix_web::dev