diff options
author | Christoph Helma <helma@in-silico.ch> | 2012-03-29 14:51:06 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2012-03-29 14:51:06 +0200 |
commit | 057ded12cf3038378c974a3dd5ba06ac1f9d3109 (patch) | |
tree | 810f7a00e0f435ca952e49805a698d875ea22dee /lib | |
parent | 97f9367b05a9a665022adc5c3f0a988acb1c4fa3 (diff) | |
parent | ef6b74aa8167c1cd2685e8c7ab97f6905d5a03b9 (diff) |
Merge branch 'development' of github.com:opentox/opentox-client into development
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rest-client-wrapper.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/rest-client-wrapper.rb b/lib/rest-client-wrapper.rb index aa5d9c4..479d5a5 100644 --- a/lib/rest-client-wrapper.rb +++ b/lib/rest-client-wrapper.rb @@ -16,13 +16,16 @@ module OpenTox define_singleton_method method do |uri,payload={},headers={}| # check input - @subjectid = headers[:subjectid] ? headers[:subjectid] : nil + @subjectid = headers[:subjectid] ? headers[:subjectid] : nil bad_request_error "Invalid URI: '#{uri}'" unless URI.valid? uri not_found_error "URI '#{uri}' not found." unless URI.accessible?(uri, @subjectid) unless URI.ssl?(uri) bad_request_error "Headers are not a hash: #{headers.inspect}" unless headers==nil or headers.is_a?(Hash) # make sure that no header parameters are set in the payload [:accept,:content_type,:subjectid].each do |header| - bad_request_error "#{header} should be submitted in the headers" if payload and payload.is_a?(Hash) and payload[header] unless URI(uri).host == URI($aa[:uri]).host + if defined? $aa || URI(uri).host == URI($aa[:uri]).host + else + bad_request_error "#{header} should be submitted in the headers" if payload and payload.is_a?(Hash) and payload[header] + end end # create request |