from pyramid.view import (
        view_config,
        notfound_view_config,
        )

# Always send the default index.html
@notfound_view_config(renderer='templates/index.mako', accept='text/html')
@view_config(renderer='templates/index.mako', accept='text/html')
def index(request):
    return {}


from pyramid.view import (
        view_config,
        notfound_view_config,
        )

# Always send the default index.html
@notfound_view_config(renderer='templates/index.mako', xhr=False, accept='text/html')
@view_config(renderer='templates/index.mako', xhr=False, accept='text/html')
def index(request):
    return {}


Verify X-Requested-With is not set
Verify X-Requested-With is not set

  from pyramid.view import (
          view_config,
          notfound_view_config,
          )
  
  # Always send the default index.html
- @notfound_view_config(renderer='templates/index.mako', accept='text/html')
+ @notfound_view_config(renderer='templates/index.mako', xhr=False, accept='text/html')
- @view_config(renderer='templates/index.mako', accept='text/html')
+ @view_config(renderer='templates/index.mako', xhr=False, accept='text/html')
  def index(request):
      return {}
  
  
Verify X-Requested-With is not set
## Code Before:
from pyramid.view import (
        view_config,
        notfound_view_config,
        )

# Always send the default index.html
@notfound_view_config(renderer='templates/index.mako', accept='text/html')
@view_config(renderer='templates/index.mako', accept='text/html')
def index(request):
    return {}


## Instruction:
Verify X-Requested-With is not set
## Code After:
from pyramid.view import (
        view_config,
        notfound_view_config,
        )

# Always send the default index.html
@notfound_view_config(renderer='templates/index.mako', xhr=False, accept='text/html')
@view_config(renderer='templates/index.mako', xhr=False, accept='text/html')
def index(request):
    return {}

