Closed
Description
I'm seeing this error:
spec/controllers/spotlight/catalog_controller_spec.rb:308:16: C: [Correctable] Rails/ResponseParsedBody: Prefer response.parsed_body to JSON.parse(response.body).
data = JSON.parse(response.body).with_indifferent_access
^^^^^^^^^^^^^^^^^^^^^^^^^
However I can not autocorrect this as parsed_body only works in the case that there is a parser found for the corresponding mime type. https://api.rubyonrails.org/classes/ActionDispatch/TestResponse.html#method-i-parsed_body
My response doesn't have one:
response.content_type
"application/solr+json; charset=utf-8"
So this cop depends on the assumption that the request has a mime-type of application/json
, which isn't going to be true for all cases.
Activity