request.env.to_json fails
-
macournoyer
- State changed from new to invalid
rack.errors is set to STDERR. It's like doing STDERR.to_json
I guess you could set rack.errors to nil before doing that or create another hash w/ only the keys you want, or do something like:
request.env.keys.sort.inject({}) {|e,(k,v)| e[k] = v.to_s }.to_json -
Greg Hazel
Isn't there a better place for than sort of variable than env? It would be neat it the environment was entirely made of strings, like a shell environment.
-
macournoyer
That's the Rack environment, nothing to do w/ shell env. Rack env is the
only way to pass data around from request to response across apps and
middlewares. Restricting to strings would be uselessly restrictive and
degrade performance. -
Greg Hazel
It is very related to the CGI environment variables, which have classically been strings since they were passed by the shell. The Rack parameters which are not strings have been conflated with the CGI parameters. This makes the hash difficult to serialize, when the rack variables should not be passed through a CGI-like interface.
There are many options for improving this situation:
1) Have "request.rack" separate from "request.env"
2) Have "request.env['rack']" contain a hash of all the rack-related variables
3) Have "request.env['cgi']" contain all the CGI-like environment variables
-
kbrow8249
I almost completed my dissertation on time, everything was going smoothly and according to the plan but then
I had major personal problems and couldn’t finish editing. I sent my papers to
essay helper online service and they completed it splendidly.
These guys are rescued me and i will recommend this company to all my colleagues!
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.