swsnu / wecfall2014

0 stars 0 forks source link

Post to Heroku #14

Open HaritzPuerto opened 9 years ago

HaritzPuerto commented 9 years ago

Hello! I'm sorry to disturb you again, but I have a new problem. I have already deployed the assignment to Heroku and using the GUI works. Then, I wanted to test sending post messages as you are going to do to test it. In order to do that, I installed the plug-in for firefox "HttpRequester" and I sent a post request to the web app but I obtained the following error:

POST http://assignment1haritz.herokuapp.com/signup?username=LongName&password=1234567890 Content-Type: application/xml -- response -- 422 Unprocessable Entity Connection: keep-alive Content-Type: text/html; charset=utf-8 Content-Length: 1334 X-Request-Id: 23accd09-64d3-4255-b0de-00a916ff3d76 X-Runtime: 0.005952 Server: WEBrick/1.3.1 (Ruby/2.0.0/2014-09-19)

I've tried checking the logs using "heroku logs" but I don't understand anything. You can check the result of "heroku logs" here: http://www.miblocdenotas.com/21315 How can I solve that problem? Am I sending wrong the post request?

Thank you.

Haritz

nosoyilse commented 9 years ago

I think it is because it is sending text and not json format in this part: Content-Type: text/htm

In the plugin you have to change content-type to applications/json in the header

It worked for me

HaritzPuerto commented 9 years ago

Hi! I've tried as you said but it didn't work. I also tried using application/json and nothing. I don't know what to do... Thank you!!

POST http://assignment1haritz.herokuapp.com/signup?username=Longname&password=1234567890 Content-Type: applications/json

-- response -- 422 Unprocessable Entity Connection: keep-alive

Content-Type: text/html; charset=utf-8

Content-Length: 1334

X-Request-Id: 271824b9-c2a1-4a31-bf21-adf05d30a999

X-Runtime: 0.006302

Server: WEBrick/1.3.1 (Ruby/2.0.0/2014-09-19)

Date: Fri, 10 Oct 2014 01:22:26 GMT

Via: 1.1 vegur

taegeonum commented 9 years ago

Does this work well on your local machine?

HaritzPuerto commented 9 years ago

No, and it says: POST http://localhost:3000/signup?username=Longname&password=1234567890 Content-Type: application/json

-- response -- 422 Unprocessable Entity Content-Type: text/html; charset=utf-8

Content-Length: 15418

X-Request-Id: 075b8d65-346c-4562-b258-8e07d9ee38c6

X-Runtime: 0.044672

Server: WEBrick/1.3.1 (Ruby/2.0.0/2014-05-08)

Date: Fri, 10 Oct 2014 07:15:08 GMT //More things ActionController::InvalidAuthenticityToken Thank you! But json tests pass...