﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23977	Add setdefault() to HttpResponse	Robert Coup	Sergey	"HttpResponse acts like a dictionary with respect to headers. It's a common middleware pattern to set headers ''unless'' they've been explicitly set by the view. eg.

{{{
class MyMiddleware(object):
  def process_response(self, request, response):
    if not 'X-Test' in response:
      response['X-Test'] = 12345
    return response
}}}

Having a `setdefault()` implementation would simplify this (not much in the trivial one-header case, but for example CORS middleware where you're setting a number of headers)

{{{
class MyMiddleware(object):
  def process_response(self, request, response):
    response.setdefault('X-Test', 12345)
    return response
}}}
"	New feature	closed	HTTP handling	dev	Normal	fixed		Дилян Палаузов	Ready for checkin	1	0	0	0	1	0
