Receiving POST with Rack ruby server -


i have simple ruby server :

app = proc.new |env|    puts 'am receiving ? '    req = rack::request.new(env).params    puts "if yes parameters ? : #{req.inspect}"  end   rack::handler::thin.run(app, :port => 4001, :threaded => true) 

how supposed receive post request parameters , i'm sending json object using post can see nothing i'm receiving nothing when send post localhost:4001 .

that's because not returning response. response empty won't see anything. can test through curl:

$ curl -f 'foo=bar' localhost:4001 curl: (52) empty reply server 

response within app:

am receiving ?  if yes parameters ? : {"foo"=>"bar"} 

try returning something:

app = proc.new |env|   puts 'am receiving ? '   req = rack::request.new(env).params   puts "if yes parameters ? : #{req.inspect}"   [200, { 'content-type' => 'text/plain' }, ['some body']] end 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -