curl on macos Catalina not displaying response body

Viewed 798

Tried to make a curl to https://transfer.sh with curl and the response body disappear from the screen. I made a gif from my terminal: https://giphy.com/gifs/hvjZcaFbRPl9LbsBXg

I'm trying to run this cmd, where test is a text file:

curl --upload-file test https://transfer.sh

For workaround, I'm using a inline python script, which works pretty well:

python -c 'import requests; print(requests.post("https://transfer.sh/", files={"upload_file": open("test","rb")}).text)'
2 Answers

Can fix with -w "\n":

curl --upload-file test -s -w "\n" https://transfer.sh

curl seems to be giving the terminal a carriage return. Try stripping out carriage returns using tr:

curl --upload-file test https://transfer.sh | tr -d '\r'

Related