@@ -20,6 +20,7 @@ pub struct State {
2020 pub responses : HashMap < String , Response > ,
2121 pub pending_operations : HashSet < String > ,
2222 pub spinner_frame : usize ,
23+ pub global_headers : Vec < ( String , String ) > ,
2324}
2425
2526#[ derive( Debug , Default , Clone ) ]
@@ -72,6 +73,7 @@ impl State {
7273 responses : HashMap :: default ( ) ,
7374 pending_operations : HashSet :: default ( ) ,
7475 spinner_frame : 0 ,
76+ global_headers : Vec :: new ( ) ,
7577 } )
7678 }
7779
@@ -104,15 +106,18 @@ impl State {
104106 responses : HashMap :: default ( ) ,
105107 pending_operations : HashSet :: default ( ) ,
106108 spinner_frame : 0 ,
109+ global_headers : Vec :: new ( ) ,
107110 } )
108111 }
109112
110- pub async fn from_input ( input : String ) -> Result < Self > {
111- if let Ok ( url) = reqwest:: Url :: parse ( input. as_str ( ) ) {
112- State :: from_url ( url) . await
113+ pub async fn from_input ( input : String , global_headers : Vec < ( String , String ) > ) -> Result < Self > {
114+ let mut state = if let Ok ( url) = reqwest:: Url :: parse ( input. as_str ( ) ) {
115+ State :: from_url ( url) . await ?
113116 } else {
114- State :: from_path ( input) . await
115- }
117+ State :: from_path ( input) . await ?
118+ } ;
119+ state. global_headers = global_headers;
120+ Ok ( state)
116121 }
117122
118123 pub fn get_operation ( & self , operation_id : Option < String > ) -> Option < & OperationItem > {
0 commit comments