File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -527,14 +527,22 @@ def create_webdav_dir_if_needed(url)
527527 def do_stream_file ( uri , filename , _options = { } )
528528 GoodData . logger . info "Uploading file user storage #{ uri } "
529529
530- request = RestClient ::Request . new ( :method => :put ,
531- :url => uri . to_s ,
532- :verify_ssl => verify_ssl ,
533- :headers => @webdav_headers . merge ( :x_gdc_authtt => headers [ :x_gdc_authtt ] ) ,
534- :payload => File . new ( filename , 'rb' ) )
530+ # Build the request inside the retryable block so that, after a token
531+ # refresh triggered by a 401, the new x_gdc_authtt header is picked up
532+ # and a fresh file handle is used for the retried upload.
533+ b = proc do
534+ request = RestClient ::Request . new ( :method => :put ,
535+ :url => uri . to_s ,
536+ :verify_ssl => verify_ssl ,
537+ :headers => @webdav_headers . merge ( :x_gdc_authtt => headers [ :x_gdc_authtt ] ) ,
538+ :payload => File . new ( filename , 'rb' ) )
539+ request . execute
540+ end
535541
536542 begin
537- request . execute
543+ GoodData ::Rest ::Connection . retryable ( :tries => Helpers ::GD_MAX_RETRY , :refresh_token => proc { refresh_token } ) do
544+ b . call
545+ end
538546 rescue => e
539547 raise "Error when uploading file #{ filename } . Error: #{ e } "
540548 end
Original file line number Diff line number Diff line change 228228 end
229229 end
230230
231- xit "should be possible to download deployed process" do
231+ it "should be possible to download deployed process" do
232232 process = @project . deploy_process ( './spec/data/hello_world_process/hello_world.zip' ,
233233 type : 'RUBY' ,
234234 name : 'Test ETL zipped file Process' )
You can’t perform that action at this time.
0 commit comments