File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 55import re
66from functools import partial , update_wrapper
77
8+ import xml .dom .minidom
9+
810import sys
911if sys .version_info [0 :2 ] > (3 ,0 ):
1012 import http .client
@@ -388,6 +390,22 @@ def application_json(self):
388390 # XXX: This isn't technically correct, but we'll hope for the best.
389391 # Patches welcome!
390392
393+ def application_xml (self ):
394+ self .decodeBody ()
395+
396+ try :
397+ pybody = xml .dom .minidom .parseString (self .body )
398+ except Exception : #TODO: What kind of exceptions?
399+ pybody = self .body
400+
401+ return pybody
402+
403+
404+ text_xml = application_xml
405+ # The difference between text/xml and application/xml is whether it
406+ # is human-readable or not. For our purposes, there is no
407+ # difference. RFC 3023, L270.
408+
391409 # Insert new Response media-type handlers here
392410
393411class RequestBody (Body ):
You can’t perform that action at this time.
0 commit comments