'Given a request and the original environ used to call the batch, return
a new environ parsable/suitable for the individual api call.'

def _build_request_environ(self, original_environ, request):

    request_environ = original_environ.copy()
    request_environ['CONTENT_TYPE'] = request.get('contentType', 'application/json')
    request_environ['REQUEST_METHOD'] = request.get('method', request.get('type', 'GET'))
    url = '{0}://{1}{2}'.format(request_environ.get('wsgi.url_scheme'), request_environ.get('HTTP_HOST'), request['url'])
    parsed = urlparse(url)
    request_environ['PATH_INFO'] = parsed.path
    request_environ['QUERY_STRING'] = parsed.query
    request_body = request.get('body', u'')
    request_environ['CONTENT_LENGTH'] = None
    request_body = io.BytesIO(bytearray(request_body, encoding='utf8'))
    request_environ['wsgi.input'] = request_body
    return request_environ
