def test_requestHeaders(self):
    "\n        The request headers are available on the request object passed to a\n        distributed resource's C{render} method.\n        "
    requestHeaders = {}
    logObserver = proto_helpers.EventLoggingObserver()
    globalLogPublisher.addObserver(logObserver)
    req = [None]

    class ReportRequestHeaders(resource.Resource):

        def render(self, request):
            req[0] = request
            requestHeaders.update(dict(request.requestHeaders.getAllRawHeaders()))
            return b''

    def check_logs():
        msgs = [e['log_format'] for e in logObserver]
        self.assertIn('connected to publisher', msgs)
        self.assertIn('could not connect to distributed web service: {msg}', msgs)
        self.assertIn(req[0], msgs)
        globalLogPublisher.removeObserver(logObserver)
    request = self._requestTest(ReportRequestHeaders(), headers=Headers({'foo': ['bar']}))

    def cbRequested(result):
        self.f1.proto.notifyOnDisconnect(check_logs)
        self.assertEqual(requestHeaders[b'Foo'], [b'bar'])
    request.addCallback(cbRequested)
    return request
The request headers are available on the request object passed to a
distributed resource's C{render} method.
def test_requestHeaders(self):
    "\n        The request headers are available on the request object passed to a\n        distributed resource's C{render} method.\n        "
    requestHeaders = {}
    logObserver = proto_helpers.EventLoggingObserver()
    globalLogPublisher.addObserver(logObserver)
    req = [None]

    class ReportRequestHeaders(resource.Resource):

        def render(self, request):
            req[0] = request
            requestHeaders.update(dict(request.requestHeaders.getAllRawHeaders()))
            return b

    def check_logs():
        msgs = [e['log_format'] for e in logObserver]
        self.assertIn('connected to publisher', msgs)
        self.assertIn('could not connect to distributed web service: {msg}', msgs)
        self.assertIn(req[0], msgs)
        globalLogPublisher.removeObserver(logObserver)
    request = self._requestTest(ReportRequestHeaders(), headers=Headers({'foo': ['bar']}))

    def cbRequested(result):
        self.f1.proto.notifyOnDisconnect(check_logs)
        self.assertEqual(requestHeaders[b'Foo'], [b'bar'])
    request.addCallback(cbRequested)
    return request