zerovm/zerocloud — pull request #120 by pkit (2014-07-30 15:26:11+00:00)
Title: correctly pass request payload to any type of job

this patch makes it possible to pass arbitrary payload (of POST or PUT) into the zerovm application(s)
it is an improvement on b36559a1e5ceaccce9b250f2c3f87f1c3b84371b
fixed things are:
- correclty pass payload to chained jobs
- better handle job descriptions that expect payload (faster checks)
- generalize payload handling in ChainMiddleware
- correctly handle crippled case where no ChainMiddleware is present
- improve test framework to support CGI env variables

all of the above is quite coupled, that's why I use a single commit here

the main idea is simple: original `env['wsgi.input']` is stored as another variable `env['chain.input']`
after chained job or other middleware overwrites or alters `env['wsgi.input']` the original input is still available under `env['chain.input']`
because `env['chain.input']` is just a pointer when some job wants to read from it we just check if it was not consumed previously and then give it to the job
each job in chain can partially consume input, but obvioulsy cannot restore it after it was consumed