lib/hik_openapi.rb in hik_openapi-0.2 vs lib/hik_openapi.rb in hik_openapi-0.2.1
- old
+ new
@@ -40,10 +40,10 @@
def perform
ctx = OpenSSL::SSL::SSLContext.new
ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
response = http_client.headers(sign_headers(@headers)).public_send(@request_method, @uri.to_s, request_options.merge(ssl_context: ctx))
- response_body = response.body.empty? ? '' : symbolize_keys!(response.parse)
+ response_body = response.code == 200 ? symbolize_keys!(response.parse) : {}
response_headers = response.headers
{
headers: response_headers,
body: response_body,
}