mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
v2v: -o rhv-upload: Fix test so it doesn't fail if Content-Length header missing.
If the Content-Length header was missing from the headers returned by the server then the test would fail with: KeyError: 'content-length' This happens on RHEL 7.6 in particular. We can fix this by using an alternate method to fetch the header, which will return None instead of throwing an exception if the header doesn't exist. See: https://stackoverflow.com/a/19255675
This commit is contained in:
@@ -146,7 +146,7 @@ class RequestHandler(BaseHTTPRequestHandler):
|
||||
self.end_headers()
|
||||
|
||||
def discard_request(self):
|
||||
length = self.headers['Content-Length']
|
||||
length = self.headers.get('Content-Length')
|
||||
if length:
|
||||
length = int(length)
|
||||
content = self.rfile.read(length)
|
||||
|
||||
Reference in New Issue
Block a user