Send body with type x-www-form-urlencoded, in Active resource

160 Views Asked by At

Using Active Resource I have to send the authentication with the type x-www-form-urlencoded, however it is sending it with the json format:

In my model base

self.site = 'http://url.ngrok.io/api'

En rails console

login = Namespace::Login
login.create username: "username", password: "password"

Response

ActiveResource::UnauthorizedAccess: Failed.  Response code = 401

In the request continue sending in json format

{"username": "username", "password": "password"}"

It should be sent this way

username=username&password=password

Guide me from this tutorial to make a post http://tutorials.jumpstartlab.com/topics/web_services/active_resource.html

Thank you very much for your help...

0

There are 0 best solutions below