postmanlabs / httpbin

HTTP Request & Response Service, written in Python + Flask.
https://httpbin.org
ISC License
12.79k stars 1.81k forks source link

Submitted XML POST data is stripped of markup #371

Open spemberton opened 7 years ago

spemberton commented 7 years ago

I posted something along the lines of this (details might slightly differ)

POST / HTTP/1.1 Connection: keep-alive Content-Type: application/xml Accept: / Accept-Encoding: gzip, deflate, br Accept-Language: en-GB,nl-NL;q=0.8,nl;q=0.6,en-US;q=0.4,en;q=0.2 Origin: http://homepages.cwi.nl User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36 Dnt: 1 Referer: http://homepages.cwi.nl/~steven/forms/examples/michiel3.xml Content-Length: 907

predictionThe web failsNot yet... Sorry.W3C5I like this formotherHello mum!5ISOC W3Ctechnical+31steven@pemberton.nltrueTim Berners-Leetimbl@w3.orgFred Bloggsfred@blogs.netNoWeb wouldn't fail!About a yearParallelUK govtPeople Money Wine

and got back

{ "args": {}, "data": "predictionThe web failsNot yet\n\nSorryW3C5I like this formotherHello mum!ISOC W3C+310steven@pemberton.nltrueTimbltimbl@w3.orgFred Bloggsfred@bloggs.net", "files": {}, "form": {}, "headers": { "Accept": "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, /;q=0.1", "Accept-Encoding": "gzip, deflate", "Accept-Language": "en-GB,en-US;q=0.9,en;q=0.8,nl-nl;q=0.7,nl;q=0.6,fr;q=0.5", "Connection": "close", "Content-Length": "654", "Content-Type": "application/xml", "Host": "httpbin.org", "Origin": "http://homepages.cwi.nl", "Referer": "http://homepages.cwi.nl/~steven/forms/examples/michiel3.xml", "User-Agent": "Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.16" }, "json": null, "origin": "82.161.119.74", "url": "http://httpbin.org/post" }

In other words, for an XML POST the data: field of the returned values has been stripped of its markup.

spemberton commented 7 years ago

Hmm, the markup has been stripped from my POST data as well :-) It should start

<data xmlns=""><answers><type>prediction</type><answer type="prediction"><description>The web fails

javabrett commented 6 years ago

@spemberton can you update the issue and take care to code-escape the example request, or use a pastebin. Currently it is not readable.