Search code examples
textwebcontent-type

Which HTML content type to return data and avoid my line feeds being banalized into spaces


I am running a small web server in python (cherrypy). I wish to return data of the following format:

20100701,1.5127
20100702,1.5184
20100705,1.51075

So at the moment my python looks like that in order to test the output:

return """20100701,1.5127
20100702,1.5184
20100705,1.51075
"""

When I request the URL from my other end, the one supposed to use the data, and expecting to parse line by line, I get the following output:

20100701,1.5127 20100702,1.5184 20100705,1.51075

Line feeds have been replaced by spaces... I guess this might be because my server considers I am sending html, so ignores my line feeds...


Solution

  • Set the content type of the response to text/plain.