Created
November 21, 2013 11:36
-
-
Save fronx/7580113 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
HTTP: | |
GET /some/path?a=b&c=d | |
Sinatra, inside 'get' block: | |
params == {:a => 'b', :c => 'd'} | |
HTTP: | |
GET /blog/post-123?page=1 | |
Sinatra, inside 'get' block: | |
params == {:page => 1} | |
An HTTP POST request is (usually) the result of sending a form. | |
In Sinatra, inside a 'post' block, params is | |
a representation of the form fields and values as a hashmap. | |
HTML form: | |
username: [ sheley ] | |
password: [ passwort ] | |
Sinatra: | |
params == {:username => 'sheley', :password => 'passwort'} | |
Parts of the URL can also be interpreted as parameters: | |
Sinatra: | |
get '/blog/:post' do | |
# GET /blog/post-123?page=1 | |
# params == {:post => 'post-123', :page => 1} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@sheley Does this work?