Add constructor to Sse (#244)

I think this is more consistent with the rest of the API
This commit is contained in:
David Pedersen
2021-08-23 17:51:30 +02:00
committed by GitHub
parent a753eac23f
commit 6777dc1e5c
3 changed files with 22 additions and 26 deletions
+2 -2
View File
@@ -8,7 +8,7 @@ use axum::{
extract::TypedHeader,
handler::get,
http::StatusCode,
response::sse::{sse, Event, Sse},
response::sse::{Event, Sse},
Router,
};
use futures::stream::{self, Stream};
@@ -59,5 +59,5 @@ async fn sse_handler(
.map(Ok)
.throttle(Duration::from_secs(1));
sse(stream)
Sse::new(stream)
}