mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 03:18:53 +00:00
Add helper methods for last response
This commit is contained in:
parent
6f1dd5ce35
commit
846d282ba0
@ -63,6 +63,14 @@ module {{moduleName}}
|
||||
response_body = request.response.body
|
||||
Swagger.configuration.auth_token = response_body['token']
|
||||
end
|
||||
|
||||
def last_response
|
||||
Thread.current[:swagger_last_response]
|
||||
end
|
||||
|
||||
def last_response=(response)
|
||||
Thread.current[:swagger_last_response] = response
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -138,7 +138,7 @@ module {{moduleName}}
|
||||
end
|
||||
|
||||
# record as last response
|
||||
Thread.current[:swagger_last_response] = @response
|
||||
Swagger.last_response = @response
|
||||
|
||||
unless @response.success?
|
||||
fail ApiError.new(:code => @response.code,
|
||||
|
@ -63,6 +63,14 @@ module Petstore
|
||||
response_body = request.response.body
|
||||
Swagger.configuration.auth_token = response_body['token']
|
||||
end
|
||||
|
||||
def last_response
|
||||
Thread.current[:swagger_last_response]
|
||||
end
|
||||
|
||||
def last_response=(response)
|
||||
Thread.current[:swagger_last_response] = response
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -137,7 +137,7 @@ module Petstore
|
||||
end
|
||||
|
||||
# record as last response
|
||||
Thread.current[:swagger_last_response] = @response
|
||||
Swagger.last_response = @response
|
||||
|
||||
unless @response.success?
|
||||
fail ApiError.new(:code => @response.code,
|
||||
|
Loading…
Reference in New Issue
Block a user