view · edit · sidebar · attach · print · history




  • port sbsm/ to use the rack webserver. Fix handling POST requests
  • Keep in Mind



port sbsm/ to use the rack webserver. Fix handling POST requests

Why does a POST request not return the correct content?

When running several unit test I sometimes receive errors like Address already in use - bind(2) for "localhost" port 10001 or problems removing /tmp/smb_lock. Why? Solved this problem by waiting for the drb_server to be ready with until @drb_server && @drb_server.alive? do sleep 0.005 end after calling DRb.start_service. Pushed the commit Reworked the unit test for rack

Improved the POST test by setting cookies with result = post '/hello/', "HTTP_COOKIE" => "_session_id=332b306f524c0cee31dddabe5bbaaaa". Now the session_id gets passed as a cookie. Do I have to add also a sbsm-persistent-cookie? Added it, but still getting wrong content.

Debugging with pry I see in sbsm/lib/sbsm/state.rb in the method trigger(event) that the event :confirm is triggered, but the self does not respond to it. Why? self is Steinwies::HomeState.

in sbsm/request.rb (method drb_process) added the lines

      cookie_input['_session_id'] = @session.session_id
      cookie_input['language'] = @cgi.params[ "rack.request.query_hash"]['language']

and now the response contains header-lines of type Set-Cookie. But it still does not return the correct confirm page.

Somehow I must extract event=confirm from the Rack::Request.env, which is e.g.

  request.env[ "rack.request.form_vars"]
   => "\n

Tried various variants to generate good cookies. But now I think this should be okay.

Pushed commits:

But I must still solve the failing unit test, as shown by the travis-CI log

  Fabulous ru0mn in 0.333834s, 29.9550 runs/s, 158.7615 assertions/s.
  1) Failure:
  SteinwiesTest#test_kontakt_submit_kontakt [/home/travis/build/ngiger/]:
  Response body must include <Mail senden>.
  Expected: true
  Actual: false
view · edit · sidebar · attach · print · history
Page last modified on October 19, 2016, at 06:04 PM