INNER CODE UNIT · Python

get_protocol

bobbui/json-logging-python · json_logging/framework/connexion/__init__.py:189

    def get_protocol(self, request):
        if _is_async_request(request):
            http_version = request.scope.get('http_version')
            return 'HTTP/' + http_version if http_version else json_logging.EMPTY_VALUE
        return request.environ.get('SERVER_PROTOCOL')

    def get_path(self, request):
        if _is_async_request(request):
            return request.url.path
        return request.path

    def get_content_length(self, request):
        if _is_async_request(request):
            return request.headers.get('content-length', json_logging.EMPTY_VALUE)
        return request.content_length

    def get_method(self, request):
        return request.method

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…