Created
July 9, 2010 20:43
-
-
Save harrylove/470035 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ThingsController < ApplicationController | |
# curl -c mycookies localhost:3000/things/new | |
# The "-c" flag will create/overwrite a cookie file named "mycookies" | |
def new | |
render :json => { :authenticity_token => form_authenticity_token } | |
end | |
# curl -i -b cookies -d "test=hey&authenticity_token=[URLEncoded auth token]" localhost:3000/things | |
# The "-i" flag returns the response header (optional) | |
# The "-b mycookies" flag uses the cookie file from the previous request | |
# To URLEncode the auth string, just replace the "+" with "%2B" | |
def create | |
logger.info(params[:test]) | |
render :nothing => true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment