process_template_response must return an HttpResponse. · Issue #46 · microsoft/ApplicationInsights-Python · GitHub
Skip to content

process_template_response must return an HttpResponse. #46

Description

@allieus

function "process_template_response" must return an HttpResponse. The code below returns None.

Error Point : https://github.com/Microsoft/ApplicationInsights-Python/blob/master/applicationinsights/django/middleware.py#L215

Ref django code : https://github.com/django/django/blob/master/django/core/handlers/base.py#L150

Here's what you can change:

def process_template_response(self, request, response):
    if hasattr(request, 'appinsights') and hasattr(response, 'template_name'):
        data = request.appinsights.request
        data.properties['template_name'] = response.template_name

    return response  # FIX POINT

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions