mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-12-19 00:22:10 +03:00
f82ed05d9a
Previously, the parser was rather raw: we processed the buffer bytes by bytes, checking if the buffer was a valid XML file. Now, we use libxml SAX parser to detect the end of the XML.
29 lines
593 B
Python
29 lines
593 B
Python
# coding=utf-8
|
|
from flask import request
|
|
from app import app
|
|
|
|
|
|
@app.route("/post-xml", methods=["POST"])
|
|
def post_xml():
|
|
s = request.data.decode("utf-8")
|
|
assert (
|
|
s
|
|
== """<?xml version="1.0"?>
|
|
<drink>caf\u00e9</drink>"""
|
|
)
|
|
return ""
|
|
|
|
|
|
@app.route("/post-xml-no-prolog", methods=["POST"])
|
|
def post_xml_no_prolog():
|
|
s = request.data.decode("utf-8")
|
|
assert s == """<drink>caf\u00e9</drink>"""
|
|
return ""
|
|
|
|
|
|
@app.route("/post-xml-large", methods=["POST"])
|
|
def post_xml_large():
|
|
s = request.data.decode("utf-8")
|
|
assert len(s) == 22156
|
|
return ""
|