1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 17:15:35 +00:00

Add HeadersDict, and mark add_header deprecated.

HeadersDict is a subclass of CaseInsensitiveDict with two new features:

  1. Preserve the case of the header key from the first time it was set.
     This means that later munging won't modify the key case. (You can
     force picking up the new case with `del` followed by setting.)

  2. If the value is a list or tuple, unpack it and store the first
     element. This is the same as how `Request.add_header()` used to work.

For backward compatibility this commit preserves `Request.add_header()` but
marks it deprecated.
This commit is contained in:
Aron Griffis
2015-08-24 22:14:38 -04:00
parent 646d12df94
commit 7312229aef
4 changed files with 79 additions and 35 deletions

View File

@@ -188,8 +188,7 @@ class VCRConnection(object):
log.debug('Got {0}'.format(self._vcr_request))
def putheader(self, header, *values):
for value in values:
self._vcr_request.add_header(header, value)
self._vcr_request.headers[header] = values
def send(self, data):
'''