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

curl_translate() bugs #500

Open
mgirlich opened this issue Jul 12, 2024 · 1 comment · May be fixed by #619
Open

curl_translate() bugs #500

mgirlich opened this issue Jul 12, 2024 · 1 comment · May be fixed by #619
Labels
bug an unexpected problem or unintended behavior curl-translate 🌍
Milestone

Comments

@mgirlich
Copy link
Collaborator

A couple of bugs I found when creating the PR for curlconverter.com

Crashes

library(httr2)
curl_translate("curl -X GET \"http://localhost:28139/cookies\" -H \"accept: application/json\" -H 'Cookie: mysamplecookie=someValue; emptycookie=; otherCookie=2'")
#> Error in `httr2::url_parse()`:
#> ! `url` must be a single string, not a character vector.

Wrong url

curl_translate("curl httpbin.org")
#> request("/httpbin.org") |> 
#>   req_perform()

Missing headers:

curl_translate("curl --header \"Content-Type: text/xml;charset=UTF-8\" --header \"getWorkOrderCancel;\" localhost:28139/get")
#> request("localhost:///28139/get") |> 
#>   req_perform()

Created on 2024-07-12 with reprex v2.1.0

@hadley hadley added bug an unexpected problem or unintended behavior curl-translate 🌍 labels Sep 3, 2024
@hadley hadley added this to the v1.1.0 milestone Dec 24, 2024
@hadley
Copy link
Member

hadley commented Dec 24, 2024

  1. I think maybe we shouldn't bother supporting this, since adjusting our parse to allow the url to be in any position is going to be a lot of work, and I don't think it's that common in the wild.
  2. Now that we use curl to parse urls maybe we can get this working: Flexible URL parse? jeroen/curl#368
  3. Assuming the last one is a typo and should be --header \"getWorkOrderCancel;\", I'll have a PR shortly.

hadley added a commit that referenced this issue Dec 24, 2024
@hadley hadley linked a pull request Dec 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior curl-translate 🌍
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants