Request duplicate

I am fixing an application that should support a duplicate character in requests sent to the server (for development). Requests are sent via JSON. Currently, if I call the following more than once:

curl -v -b cookie.file -c cookie.file -H "Content-Type: application/json" -X POST -d '{"user":{"username":"kevin","password":"password"}}' http://localhost:3000/users/sign_in.json 

The first results are in status code 201 , and the second result is in 302 , which redirects to the HTML page. I overridden the create method in Users::SessionsController , however, the user code is only called on the first POST (nothing happens for the second). Any way to get a second request not to redirect? Here is what I still have:

 class Users::SessionsController < Devise::SessionsController def create logger.info "Users::SessionController" super end end 
+4
source share
2 answers

I ended up here because I had the same problem. The mark for non-navigation formats was not idempotent, as I was redirected to the html version if I had already passed authentication.

This issue has been resolved since September 29th with this commit.

Today you must use an edge device to make it work with your application.

 # Gemfile gem 'devise', git: 'git://github.com/plataformatec/devise.git' 
+2
source

Overriding SessionController is not as simple as other things in Devise. I think what you are asking for is very similar in this article . This may not be entirely accurate, but it concerns how to create a pure JSON login environment.

0
source

All Articles