Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
非常に単純なSinatraコード
get '/Accept/:value' do "Hello world" end not_found do "not found" end
私がシナトラに行くとき、http://localhost:9292/Accept/?SomeKey=somevalue&Somekey2=someValueいつも「見つかりません」を私に返します。
http://localhost:9292/Accept/?SomeKey=somevalue&Somekey2=someValue
私は何が間違っているのですか?
Sinatraは、クエリ文字列の開始を示す/Accept/最後のスラッシュの直後に続くため、URLを認識します。?
/Accept/
?
次のようなURLhttp://localhost:9292/Accept/foo?SomeKey=somevalue&Somekey2=someValueは、getアクションをヒットし、として渡さfooれparams[:value]ます。
http://localhost:9292/Accept/foo?SomeKey=somevalue&Somekey2=someValue
foo
params[:value]