lib/zerobounce/error.rb in zerobounce-0.1.0 vs lib/zerobounce/error.rb in zerobounce-0.1.1
- old
+ new
@@ -35,11 +35,11 @@
private
# @param [Hash] env
# @return [Error]
def parse_500(env)
- if env[:body]&.start_with?('Missing parameter')
+ if env[:body].to_s.start_with?('Missing parameter')
MissingParameter.new(env)
else
InternalServerError.new(env)
end
end
@@ -47,10 +47,10 @@
# @param [Hash] env
# @return [Error, nil]
def parse_200(env)
# The body hasn't been parsed yet and to avoid potentially parsing the body twice
# we just use String#start_with?
- ApiError.new(env) if env[:body]&.start_with?('{"error":"')
+ ApiError.new(env) if env[:body].to_s.start_with?('{"error":"')
end
end
end
# Server returned a 500 error.