ruby on rails - Parsing Request Headers in Test::Unit -
i'm trying parse http request headers in test::unit, no avail. i'm writing functional test controller so:
test "create shopify order" :order, params, {header1 => val, header2 => val} assert_response :success # make sure returns 200, first off ... end
normally, read headers like, request.headers[header1]
, returns nil
in test::unit. request
isn't defined.
how grab value of headers set in above request? , how assign them request
? app pulls webservices, , need test values passed through in headers, don't want change app code. need simulate requests in test::unit.
thanks!
knowing test quite you're using helps (thanks jesse). found i'd been looking @ doc integration tests, not functional tests, , setting headers works differently in functional tests:
http://twobitlabs.com/2010/09/setting-request-headers-in-rails-functional-tests/
so wasn't setting headers thought was. being read fine--just not set.
Comments
Post a Comment