4.4 KiB
0.7
-
Middleware trait uses
&HttpRequestinstead 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&selfinstead of&mut self -
Handler::handle()accepts reference toHttpRequest<_>instead of value -
Removed deprecated
HttpServer::threads(), use HttpServer::workers() instead. -
Renamed
client::ClientConnectorError::Connectortoclient::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 returnErrorNotFoundon failure instead ofErrorBadRequest -
ws::Message::Closenow includes optional close reason.ws::CloseCode::Statusandws::CloseCode::Emptyhave 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::sessionuse actix_web::middleware::session{CookieSessionBackend, CookieSessionError, RequestSession, Session, SessionBackend, SessionImpl, SessionStorage}; -
FromRequest::from_request()accepts mutable reference to a request -
FromRequest::Resulthas to implementInto<Reply<Self>> -
Responder::respond_to()is generic overS -
Use
Queryextractor 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
WsWritertrait. you need to useuse actix_web::ws::WsWriter
0.5
-
HttpResponseBuilder::body(),.finish(),.json()methods returnHttpResponseinstead ofResult<HttpResponse> -
actix_web::Method,actix_web::StatusCode,actix_web::Versionmoved toactix_web::httpmodule -
actix_web::headermoved toactix_web::http::header -
NormalizePathmoved toactix_web::httpmodule -
HttpServermoved toactix_web::server, added newactix_web::server::new()function, shortcut foractix_web::server::HttpServer::new() -
DefaultHeadersmiddleware does not use separate builder, all builder methods moved to type itself -
StaticFiles::new()'s show_index parameter removed, useshow_files_listing()method instead. -
CookieSessionBackendBuilderremoved, all methods moved toCookieSessionBackendtype -
actix_web::httpcodesmodule is deprecated,HttpResponse::Ok(),HttpResponse::Found()and otherHttpResponse::XXX()functions should be used instead -
ClientRequestBuilder::body()returnsResult<_, actix_web::Error>instead ofResult<_, http::Error> -
Applicationrenamed to aApp -
actix_web::Reply,actix_web::Resourcemoved toactix_web::dev