Friday, 15 June 2012

ruby - How can I get request headers in their original format from Rack? -



ruby - How can I get request headers in their original format from Rack? -

i'm trying request headers in original format rack using ruby, haven't been able figure out yet. hash request.env isn't want. in hash, header keys upcased , have underscores instead of dashes, so:

"content_type"=>"application/json; charset=utf-8"

what want headers before processed, i'm looking for:

"content_type"=>"application/json; charset=utf-8"

i can plenty loop through request.env looking headers start http_ , split them, capitalize each word , gsub replace underscores dashes them format want. becomes trickier retain original format way when dealing headers such as:

"x-bt-requestid"

i sense ought able @ pre-processed headers somehow.

i'm writing http listener wrap request , forwards on service , want preserve headers in original format. know headers supposed case insensitive, if can forwards them in original format, can prevent case-sensitive issues later on when database users querying values based on these headers.

any ideas?

ruby rack

No comments:

Post a Comment