File tree Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
88# Unreleased  
99
10- -  None.
10+ -  ** breaking:**  Change ` sse::Event::json_data `  to use ` axum_core::Error `  as its error type ([ #1762  ] )
11+ 
12+ [ #1762 ] : https://github.com/tokio-rs/axum/pull/1762 
1113
1214# 0.6.10 (03. March, 2023)  
1315
Original file line number Diff line number Diff line change @@ -183,7 +183,6 @@ allowed = [
183183    " http_body" 
184184    " hyper" 
185185    " serde" 
186-     " serde_json" 
187186    " tower_layer" 
188187    " tower_service" 
189188]
Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ impl Event {
212212/// 
213213/// [`MessageEvent`'s data field]: https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent/data 
214214#[ cfg( feature = "json" ) ]  
215-     pub  fn  json_data < T > ( mut  self ,  data :  T )  -> serde_json :: Result < Event > 
215+     pub  fn  json_data < T > ( mut  self ,  data :  T )  -> Result < Event ,  axum_core :: Error > 
216216    where 
217217        T :  serde:: Serialize , 
218218    { 
@@ -221,7 +221,7 @@ impl Event {
221221        } 
222222
223223        self . buffer . extend_from_slice ( b"data:" ) ; 
224-         serde_json:: to_writer ( ( & mut  self . buffer ) . writer ( ) ,  & data) ?; 
224+         serde_json:: to_writer ( ( & mut  self . buffer ) . writer ( ) ,  & data) . map_err ( axum_core :: Error :: new ) ?; 
225225        self . buffer . put_u8 ( b'\n' ) ; 
226226
227227        self . flags . insert ( EventFlags :: HAS_DATA ) ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments