diff --git a/_ext/restclient_extensions.rb b/_ext/restclient_extensions.rb index 73f9864c5b1..f75474d349d 100644 --- a/_ext/restclient_extensions.rb +++ b/_ext/restclient_extensions.rb @@ -136,7 +136,12 @@ def execute(response) body = File.read(@cache_file) headers = {} headers = JSON.parse(File.read("#{@cache_file}.headers")) if File.exist? "#{@cache_file}.headers" - return RestClient::Response.create(body, RestClient::MockNetHTTPResponse.new(body, 200, headers), @request.args) + cachedResponse = RestClient::Response.create(body.to_json, RestClient::MockNetHTTPResponse.new(body, 200, headers), @request) + class << cachedResponse + attr_accessor :content + end + cachedResponse.content = if 'application/json'.eql? @request.headers[:accept] then JSON.parse(body) else body end; + return cachedResponse end end response