ridiculous / grape-middleware-logger

Logging middleware for Grape apps
MIT License
53 stars 32 forks source link

Parameters are empty if request is Content-Type: application/json #11

Closed nbulaj closed 8 years ago

nbulaj commented 8 years ago

Hi. If you will try to make a request with JSON body and Content-Type: application/json then logger will write an empty parameters to the log:

I, [2016-09-15T10:59:30.005328 #27381] INFO -- : [e323e78c-9627-4be5-b236-fe607ae9fb7f] Started POST "/api/v1/users" at 2016-09-15 10:59:30 +0000 I, [2016-09-15T10:59:30.005382 #27381] INFO -- : [e323e78c-9627-4be5-b236-fe607ae9fb7f] Processing by V1::Users/users/ I, [2016-09-15T10:59:30.005435 #27381] INFO -- : [e323e78c-9627-4be5-b236-fe607ae9fb7f] Parameters: {}

I think it is a bug.

nbulaj commented 8 years ago

The problem was solved by changing use Grape::Middleware::Logger to insert_after Grape::Middleware::Formatter, Grape::Middleware::Logger (as described in README).

I think that such a change had to be described in the gem post-install message so the developers could fix the problem after update (<= 1.7 to 1.7).

Closing issue.

ridiculous commented 8 years ago

Thanks, good point about the post install message 👍 Didn't think about that