Correct Content-Type for VLIST in HTTP header
This commit is contained in:
parent
c1d279e63f
commit
a2a046f35f
@ -607,14 +607,12 @@ class Application:
|
||||
if not item:
|
||||
return NOT_FOUND
|
||||
if isinstance(item, storage.BaseCollection):
|
||||
collection = item
|
||||
if collection.get_meta("tag") not in (
|
||||
"VADDRESSBOOK", "VCALENDAR"):
|
||||
tag = item.get_meta("tag")
|
||||
if not tag:
|
||||
return DIRECTORY_LISTING
|
||||
content_type = xmlutils.MIMETYPES[tag]
|
||||
else:
|
||||
collection = item.collection
|
||||
content_type = xmlutils.MIMETYPES.get(
|
||||
collection.get_meta("tag"), "text/plain")
|
||||
content_type = xmlutils.OBJECT_MIMETYPES[item.name]
|
||||
headers = {
|
||||
"Content-Type": content_type,
|
||||
"Last-Modified": item.last_modified,
|
||||
|
@ -63,6 +63,7 @@ class BaseRequestsMixIn:
|
||||
status, headers, answer = self.request("GET", path)
|
||||
assert status == 200
|
||||
assert "ETag" in headers
|
||||
assert headers["Content-Type"] == "text/calendar; charset=utf-8"
|
||||
assert "VEVENT" in answer
|
||||
assert "Event" in answer
|
||||
assert "UID:event" in answer
|
||||
@ -102,6 +103,7 @@ class BaseRequestsMixIn:
|
||||
status, headers, answer = self.request("GET", path)
|
||||
assert status == 200
|
||||
assert "ETag" in headers
|
||||
assert headers["Content-Type"] == "text/calendar; charset=utf-8"
|
||||
assert "VTODO" in answer
|
||||
assert "Todo" in answer
|
||||
assert "UID:todo" in answer
|
||||
@ -132,6 +134,7 @@ class BaseRequestsMixIn:
|
||||
status, headers, answer = self.request("GET", path)
|
||||
assert status == 200
|
||||
assert "ETag" in headers
|
||||
assert headers["Content-Type"] == "text/vcard; charset=utf-8"
|
||||
assert "VCARD" in answer
|
||||
assert "UID:contact1" in answer
|
||||
status, _, answer = self.request("GET", path)
|
||||
|
@ -42,6 +42,11 @@ MIMETYPES = {
|
||||
"VADDRESSBOOK": "text/vcard",
|
||||
"VCALENDAR": "text/calendar"}
|
||||
|
||||
OBJECT_MIMETYPES = {
|
||||
"VCARD": "text/vcard",
|
||||
"VLIST": "text/x-vlist",
|
||||
"VCALENDAR": "text/calendar"}
|
||||
|
||||
NAMESPACES = {
|
||||
"C": "urn:ietf:params:xml:ns:caldav",
|
||||
"CR": "urn:ietf:params:xml:ns:carddav",
|
||||
|
Loading…
Reference in New Issue
Block a user