server/executionhandlers/ruby/connection.rb in cpee-2.1.49 vs server/executionhandlers/ruby/connection.rb in cpee-2.1.50
- old
+ new
@@ -130,11 +130,11 @@
@controller.attributes.each do |key,value|
params << Riddl::Header.new("CPEE-ATTR-#{key.to_s.gsub(/_/,'-')}",value)
end
status = result = headers = nil
- catch :no_mock do
+ begin
tendpoint = @handler_endpoint.sub(/^http(s)?-(get|put|post|delete):/,'http\\1:')
type = $2 || parameters[:method] || 'post'
client = Riddl::Client.new(tendpoint)
@@ -142,12 +142,19 @@
@controller.callback(self,callback,:'activity-uuid' => @handler_activity_uuid, :label => @label, :activity => @handler_position)
status, result, headers = client.request type => params
if status == 561
@handler_endpoint = @handler_endpoint_orig
- throw :no_mock
+ params.delete_if { |p| p.name == 'original_endpoint' }
+ params.each do |p|
+ if p.name == 'attributes'
+ t = JSON::parse(p.value) rescue {}
+ t['mock'] = @controller.attributes['mock']
+ p.value = t.to_json
+ end
+ end
end
- end
+ end while status == 561
if status < 200 || status >= 300
headers['CPEE_SALVAGE'] = true
c = result[0]&.value
c = c.read if c.respond_to? :read