Waboodoo / HTTP-Shortcuts

Android app to create home screen shortcuts that trigger arbitrary HTTP requests
https://http-shortcuts.rmy.ch
MIT License
1.17k stars 113 forks source link

POST req imported from curl format does not have body when using --data-raw[BUG] #336

Closed pabmun closed 1 year ago

pabmun commented 1 year ago

Steps To Reproduce

  1. add new shortcut from curl
  2. Paste: curl 'http://xxxx/x.asp' -X POST -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/110.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate' -H 'Content-Type: application/x-www-form-urlencoded' -H 'X-Requested-With: XMLHttpRequest' -H 'Origin: http://1xxxx' -H 'Connection: keep-alive' -H 'Referer: http://xxxx/MainZone/index.html' --data-raw 'cmd0=PutZone_InputFunction%2FMPLAY&cmd1=aspMainZone_WebUpdateStatus%2F'

Expected behavior Body extracted with -H "Content-Type: text/plain" and some body saved

Actual behavior default Content-Type: application/x-www-form-urlencoded and no body stored

Screenshots If applicable, add screenshots to help explain your problem.

Context (please complete the following information):

Waboodoo commented 1 year ago

Thanks for the bug report.

Looks like the curl importer currently doesn't support --data-raw at all. I will add that.

I don't see what the issue is with the content-type though. In your curl command you have `-H 'Content-Type: application/x-www-form-urlencoded', so why do you think it should set the content-type to text/plain?

pabmun commented 1 year ago

I had to use content-type to text/plain to emulate the --data-raw behavior, but you are right -H 'Content-Type: application/x-www-form-urlencoded' is present in the command I didn't realized it. So it seems correct that it takes x-www-form-urlencoded as content type. I thought it was related with --data-raw issue, my mistake.

Thanks !

Waboodoo commented 1 year ago

The fix for this bug is now released as part of version 2.31.0