lib/fushin/hybrid_analysis.rb in fushin-0.3.4 vs lib/fushin/hybrid_analysis.rb in fushin-0.4.0

- old
+ new

@@ -12,10 +12,15 @@ payload = { scan_type: "all", url: url } res = HTTP.headers(default_headers).post(url_for("/quick-scan/url-to-file"), form: payload) - res.code == 200 ? JSON.parse(res.body.to_s) : nil + if res.code == 200 + JSON.parse(res.body.to_s) + else + message = JSON.parse(res.body.to_s).dig("message") + raise HAResponseError, message + end end def self.quick_url_scan(url) new.quick_url_scan(url) end