import re

class JSONPMiddleware(object):
    def process_response(self, request, response):
        if request.GET.get('callback') and re.match('[a-zA-Z0-9_]+$', request.GET.get('callback')):
            response.content = request.GET.get('callback') + '(' + response.content + ')'
        return response


import re

class JSONPMiddleware(object):
    def process_response(self, request, response):
        if request.GET.get('callback') and re.match('[a-zA-Z0-9_]+$', request.GET.get('callback')):
            response.content = request.GET.get('callback') + '(' + response.content + ')'
            response.status_code = 200 # Must return OK for JSONP to be processed
        return response


Set up JSONP requests to always return 200.
Set up JSONP requests to always return 200.

  import re
  
  class JSONPMiddleware(object):
      def process_response(self, request, response):
          if request.GET.get('callback') and re.match('[a-zA-Z0-9_]+$', request.GET.get('callback')):
              response.content = request.GET.get('callback') + '(' + response.content + ')'
+             response.status_code = 200 # Must return OK for JSONP to be processed
          return response
  
  
Set up JSONP requests to always return 200.
## Code Before:
import re

class JSONPMiddleware(object):
    def process_response(self, request, response):
        if request.GET.get('callback') and re.match('[a-zA-Z0-9_]+$', request.GET.get('callback')):
            response.content = request.GET.get('callback') + '(' + response.content + ')'
        return response


## Instruction:
Set up JSONP requests to always return 200.
## Code After:
import re

class JSONPMiddleware(object):
    def process_response(self, request, response):
        if request.GET.get('callback') and re.match('[a-zA-Z0-9_]+$', request.GET.get('callback')):
            response.content = request.GET.get('callback') + '(' + response.content + ')'
            response.status_code = 200 # Must return OK for JSONP to be processed
        return response

