Browse files

Handle auto-boxing correctly when RockingChair is disabled

  • Loading branch information...
1 parent a5c3e96 commit 4c07ba21319250113748087765e4360968bee5df @jweiss committed Sep 30, 2010
Showing with 15 additions and 15 deletions.
  1. +15 −15 lib/rocking_chair/http_adapter.rb
View
30 lib/rocking_chair/http_adapter.rb
@@ -16,46 +16,46 @@ def http_adapter
def get(uri, headers=nil)
result = http_adapter.get(uri)
- if result.is_a?(Hash)
- result
- else
+ if result.is_a?(String)
JSON.parse(result)
+ else
+ result
end
end
def post(uri, payload, headers=nil)
result = http_adapter.post(uri, payload)
- if result.is_a?(Hash)
- result
- else
+ if result.is_a?(String)
JSON.parse(result)
+ else
+ result
end
end
def put(uri, payload=nil, headers=nil)
result = http_adapter.put(uri, payload)
- if result.is_a?(Hash)
- result
- else
+ if result.is_a?(String)
JSON.parse(result)
+ else
+ result
end
end
def delete(uri, headers=nil)
result = http_adapter.delete(uri)
- if result.is_a?(Hash)
- result
- else
+ if result.is_a?(String)
JSON.parse(result)
+ else
+ result
end
end
def copy(uri, destination)
result = http_adapter.copy(uri, default_headers.merge('Destination' => destination))
- if result.is_a?(Hash)
- result
- else
+ if result.is_a?(String)
JSON.parse(result)
+ else
+ result
end
end

0 comments on commit 4c07ba2

Please sign in to comment.