Include a trailing newline in API responses

This fixes an annoyance where using, e.g.,

  git diff | curl -F 'content=<-' https://dpaste.de/api/

would place the bash prompt on the same line as the response.
This commit is contained in:
Marius Gedminas 2013-10-22 10:34:29 +03:00
parent c83c908afb
commit 815bc322b0

View file

@ -256,8 +256,8 @@ def snippet_api(request, enclose_quotes=True):
response = 'https://dpaste.de%s' % s.get_absolute_url() response = 'https://dpaste.de%s' % s.get_absolute_url()
if enclose_quotes: if enclose_quotes:
return HttpResponse('"%s"' % response) return HttpResponse('"%s"\n' % response)
return HttpResponse(response) return HttpResponse(response + '\n')
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------