Changes between Initial Version and Version 1 of Ticket #27384


Ignore:
Timestamp:
Oct 25, 2016, 10:16:38 AM (8 years ago)
Author:
Tim Graham
Comment:

I cannot reproduce a problem with the middleware you provided (though it seems to have some missing lines which I added to the description). Can you provide a test case or a sample project to reproduce?

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27384

    • Property Component UncategorizedHTTP handling
    • Property Resolutionworksforme
    • Property Status newclosed
  • Ticket #27384 – Description

    initial v1  
    33I'm creating a middleware to log every request in my API, following the new specification on django 1.10.x.
    44
    5 When I access the request.POST attr it goes blank to the view
     5When I access the `request.POST` attr it goes blank to the view.
    66
    7 {{{
    8 #!div style="font-size: 80%"
    9 Code highlighting:
    10   {{{#!python
    11     def log_request_middleware(get_response):
    12         logger = logging.getLogger('requests')
     7{{{#!python
     8import logging
    139
    14         def middleware(request):
    15             request_body = request.POST.copy().dict()
    16             response = get_response(request)
    17   }}}
     10def log_request_middleware(get_response):
     11    logger = logging.getLogger('requests')
     12
     13    def middleware(request):
     14        request_body = request.POST.copy().dict()
     15        response = get_response(request)
     16        return response
     17    return middleware
    1818}}}
    1919
    20 The request.POST on the view now is blank, it happens even with a simple access a print or assignment.
     20The `request.POST` on the view now is blank, it happens even with a simple access a print or assignment.
    2121
    22 It also happens with request.GET
     22It also happens with `request.GET`.
Back to Top