Skip to content

JSON errors get escaped #1859

@Kukunin

Description

@Kukunin

I have a simple API

  class Root < Grape::API
    content_type :json, 'application/json; charset=UTF-8'
    default_format :json

    rescue_from ActiveRecord::RecordNotFound do
      error!({ error: :not_found }, 404)
    end
  end

When an ActiveRecord::RecordNotFound is raised, I expect my API returns "{"error":"not_found"} as JSON, but it retures {&quot;error&quot;:&quot;not_found&quot;}

It worked well in 1.0.3 version but broken in 1.1.0

Is there any workaround for it?

It's related to #1763

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions