Comments (6)
Is this a bug?
Afraid not.
From RFC 2616 - "Hypertext Transfer Protocol -- HTTP/1.1", paragraph 4.2, "Message Headers":
Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive.
from vcrpy.
It occurs to me when rereading this I may have misunderstood your issue, in which case feel free to reopen with some code to reproduce the issue.
from vcrpy.
I have a unique server that transmits set-cookie
in all lower case as the header field, after doing some research, it looks like the bug is on the server not the client ... since the standard is Set-Cookie
as described in documentation. I only notice this in test because some how the case gets fixed in VCRpy.
Edit:
The phrase set-cookie
(all lower case) only occurs once in documentation rfc2109 ...
EDIT 2:
Note documentation....
Attributes (names) (attr) are case-insensitive. White space is
permitted between tokens. Note that while the above syntax
description shows value as optional, most attrs require them.
I think this means values such as set-cookie
and Set-Cookie
should be treated the same. This source thinks so tracing the source...
http/client.py#L755
headers.py#L90
It looks like at least one version of getheader
may be case insensitive.
from vcrpy.
Yeah, VCR is treating headers as case-insensitive (in accordance with RFC2616) and is normalizing them (by lowercasing them) before storing them in the cassette. That's why it's "fixing" the problem for you.
from vcrpy.
I wrote a test that's currently failing to illustrate why this might be an issue: hartsock@a86a3f7 ... I'm not 100% certain what the correct behavior should be in this circumstance but it looks like based on the headers.py#L90 reference above vcrpy might need to lower case the name used with getheader
.
from vcrpy.
I think you're right. I'll try to look into it more this weekend, but I would like VCR to be as transparent as possible when patching out httplib, including the behavior of getheader().
On Aug 1, 2014, at 12:14 PM, Shawn Hartsock [email protected] wrote:
I wrote a test that's currently failing to illustrate why this might be an issue: hartsock/vcrpy@a86a3f7 ... I'm not 100% certain what the correct behavior should be in this circumstance but it looks like based on the headers.py#L90 reference above vcrpy might need to lower case the name used with getheader.
—
Reply to this email directly or view it on GitHub.
from vcrpy.
Related Issues (20)
- autodoc fails for API documentation
- Integration tests fail with httpbin 0.10.0 HOT 3
- AIOHTTP not recording json body HOT 1
- How to run tests HOT 2
- [BUG] Doesn't work for URL's beginning with www.
- How is vcrpy importing from a parent directory in a test file HOT 1
- AttributeError: 'VCRHTTPResponse' object has no attribute 'json' HOT 2
- Add type annotations
- Backport patch to fix test failures with Python 3.12: AttributeError: type object 'VCRHTTPConnection[…]' has no attribute 'debuglevel' HOT 1
- [Duplicate of #719?] Upgrading to VCR.py that uses urllib3 v2+ causes string decoding problems with requests HOT 2
- 🛠️ Custom Persister HOT 1
- Release 6.0.0 to allow users to update to Python 3.12? HOT 20
- `TypeError: cannot pickle 'generator' object` with urllib 2.1.0, no error with urllib 1.26.18
- [Question] Would it make sense to support glob in `filter_headers`
- VCRHTTPResponse should have a `release_conn()` method
- record creation failed when using async HOT 2
- 'VCRHTTPConnection/...' has no attribute 'debuglevel'. Did you mean: 'set_debuglevel'
- Bug Report: Installation Failure of vcrpy>=5.0.0 in Conda Environment HOT 1
- Exception httpx.ResponseNotRead thrown randomly when using cassettes HOT 1
- Httpx Response content is not set/read, causing JSON parsing errors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vcrpy.