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