class JSONIndentAcceptHeaderMiddleware(object):

    def process_request(self, request):
        request.META['HTTP_ACCEPT'] = 'application/json; indent=4'
        return None

class JSONIndentAcceptHeaderMiddleware(object):

    def process_request(self, request):
        if request.META.get('HTTP_ACCEPT') == 'application/json':
            request.META['HTTP_ACCEPT'] = 'application/json; indent=4'
        return None

Apply indenting to only requests that specify application/json accept headers
PI-248: Apply indenting to only requests that specify application/json accept
headers

  class JSONIndentAcceptHeaderMiddleware(object):
  
      def process_request(self, request):
+         if request.META.get('HTTP_ACCEPT') == 'application/json':
-         request.META['HTTP_ACCEPT'] = 'application/json; indent=4'
+             request.META['HTTP_ACCEPT'] = 'application/json; indent=4'
          return None
  
Apply indenting to only requests that specify application/json accept headers
## Code Before:
class JSONIndentAcceptHeaderMiddleware(object):

    def process_request(self, request):
        request.META['HTTP_ACCEPT'] = 'application/json; indent=4'
        return None

## Instruction:
Apply indenting to only requests that specify application/json accept headers
## Code After:
class JSONIndentAcceptHeaderMiddleware(object):

    def process_request(self, request):
        if request.META.get('HTTP_ACCEPT') == 'application/json':
            request.META['HTTP_ACCEPT'] = 'application/json; indent=4'
        return None
