Skip to content

default_format :json not working #407

Closed
@bobek

Description

@bobek

Hi,

I am playing with https://github.com/djones/grape-goliath-example . My current API class looks like:

class Posts < Grape::API
  version 'v1'
  format :json
  default_format :json

  resource 'user' do
    post "/create" do
      params.except('route_info')
    end
  end
end

The original version of example is using grape 0.2.2, where both call shown below work as expected. When updated the 0.4.1 (bundle update grape) the following call works:

curl -X POST -d '{"post":{"title":"David Jones","body":"this is my message"}}' http://localhost:9000/posts/create -H Content-Type:application/json

returning

{"post":{"title":"David Jones","body":"this is my message"}}

but when application/json is ommited

curl -X POST -d '{"post":{"title":"David Jones","body":"this is my message"}}' http://localhost:9000/posts/create

the call returns

{"{\"post\":{\"title\":\"David Jones\",\"body\":\"this is my message\"}}":null}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions