File tree Expand file tree Collapse file tree 1 file changed +24
-6
lines changed
Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -100,9 +100,13 @@ impl HttpClient {
100100
101101 let form = reqwest:: multipart:: Form :: new ( ) . part ( "file" , part) ;
102102
103+ let mut headers = self . build_headers ( ) ;
104+ headers. remove ( reqwest:: header:: CONTENT_TYPE ) ;
105+
103106 let response = self
104107 . http
105108 . post ( & url)
109+ . headers ( headers)
106110 . multipart ( form)
107111 . send ( )
108112 . await
@@ -460,12 +464,26 @@ impl HttpClient {
460464 wait : bool ,
461465 timeout : Option < f64 > ,
462466 ) -> Result < serde_json:: Value > {
463- let body = serde_json:: json!( {
464- "data" : data,
465- "wait" : wait,
466- "timeout" : timeout,
467- } ) ;
468- self . post ( "/api/v1/skills" , & body) . await
467+ let path_obj = Path :: new ( data) ;
468+
469+ if path_obj. exists ( ) && path_obj. is_dir ( ) && !self . is_local_server ( ) {
470+ let zip_file = self . zip_directory ( path_obj) ?;
471+ let temp_path = self . upload_temp_file ( zip_file. path ( ) ) . await ?;
472+
473+ let body = serde_json:: json!( {
474+ "temp_path" : temp_path,
475+ "wait" : wait,
476+ "timeout" : timeout,
477+ } ) ;
478+ self . post ( "/api/v1/skills" , & body) . await
479+ } else {
480+ let body = serde_json:: json!( {
481+ "data" : data,
482+ "wait" : wait,
483+ "timeout" : timeout,
484+ } ) ;
485+ self . post ( "/api/v1/skills" , & body) . await
486+ }
469487 }
470488
471489 // ============ Relation Methods ============
You can’t perform that action at this time.
0 commit comments