1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

Add mocked response headers

This commit is contained in:
Pedro Matos Monteiro 2016-10-22 23:54:03 +01:00
parent ff37e6b4f4
commit cb521b66bb

View file

@ -43,6 +43,7 @@ module Fog
class Mock
def assume_role(role_session_name, role_arn, external_id=nil, policy=nil, duration=3600)
account_id = /[0-9]{12}/.match(role_arn)
request_id = Fog::AWS::Mock.request_id
Excon::Response.new.tap do |response|
response.status = 200
@ -54,7 +55,11 @@ module Fog
'SecretAccessKey' => Fog::Mock.random_base64(40),
'SessionToken' => Fog::Mock.random_base64(580),
'Expiration' => (Time.now + duration).utc.iso8601,
'RequestId' => Fog::AWS::Mock.request_id
'RequestId' => request_id,
}
response.headers = {
'x-amzn-RequestId' => request_id,
}
end
end