So after posting here I found the answer.
In my home directory, I had a file .curlrc, which contained
.curlrc
-w="\n"
This affects curl's output. After removing it, everything works as expected.
curl