1. Jason R. Coombs
  2. jaraco.net

Commits

Jason R. Coombs  committed fdcceea

Don't return spurious empty string key when Cache-Control header isn't present

  • Participants
  • Parent commits b5bb8cf
  • Branches default

Comments (0)

Files changed (1)

File jaraco/net/http/caching.py

View file
 		>>> sample = {'cache-control':'max-age=3, bar=baz, Foo'}
 		>>> sorted(pcc(sample).items())
 		[('bar', 'baz'), ('foo', None), ('max-age', '3')]
+
+		>>> pcc({})
+		{}
 		"""
 		def parse_part(part):
 			"""
 			return name, (val or None)
 
 		cc_header = headers.get('cache-control', '')
-		return dict(map(parse_part, cc_header.split(',')))
+		return dict(parse_part(part) for part in cc_header.split(',') if part)
 
 
 class CachedResponse(StringIO):