dabapps / django-log-request-id

Django middleware and log filter to attach a unique ID to every log message generated as part of a request
BSD 2-Clause "Simplified" License
371 stars 64 forks source link

Update middleware to be compatible with Django 4.0 #70

Closed DilLip-Chowdary-Codes closed 1 year ago

DilLip-Chowdary-Codes commented 1 year ago

The get_response argument for django.utils.deprecation.MiddlewareMixin.init() is required and doesn’t accept None

Reference Link

j4mie commented 1 year ago

Hi, sorry for the slow response on this.

I don't think I quite understand this PR. The MiddlewareMixin itself implements __init__ which takes a get_response arg docs. And you've set an HttpResponse instance to be the default value of get_response, when in fact it should be a callable that returns a response.

I've created a separate PR #71 which runs the test suite on Django 4.1 (it was already running on 4.0) and just to be safe added an integration test which uses the test client to hit Django's full request/response handling stack, rather than calling the middleware manually. Everything is working just fine.

I'll close this PR for now but please do comment if I've misunderstood.

Thanks