Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New line chars are stripped (not shown) from request body #85

Closed
modax opened this issue Jan 9, 2020 · 3 comments
Closed

New line chars are stripped (not shown) from request body #85

modax opened this issue Jan 9, 2020 · 3 comments

Comments

@modax
Copy link

modax commented Jan 9, 2020

Hello,

It seems that new line characters are stripped away during request body processing. E.g.:

printf "%s\n%s\n%s\n%s\n" a b c d | curl -H 'Content-Type: text/plain' -v -d@- https://webhook.site/38e09213-6ad6-42b0-8cb5-890939757c31

results into both "raw content" page and html preview at permalink not showing any new lines. Adding "\r" to the mix does not seem to help the case.

Thanks!

@fredsted
Copy link
Collaborator

fredsted commented Jan 9, 2020

Hi @modax, apparently with curl you have to use the --data-binary flag for curl to preserve newlines in the request body.

This worked for me:

printf "%s\n%s\n%s\n%s\n" a b c d | curl -H 'Content-Type: text/plain' -v --data-binary @- https://webhook.site/xxxxx

@fredsted fredsted closed this as completed Jan 9, 2020
@modax
Copy link
Author

modax commented Jan 10, 2020

@fredsted: Thanks a lot for the prompt response! Oh my bad, you are right! Why would curl do that by default is beyond me, very unintuitive! Thanks again!

@fredsted
Copy link
Collaborator

Yeah, it's kind of weird :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants