davenverse / curly4s

MIT License
7 stars 2 forks source link

Interactive form at the site didn't support newlines #17

Open danicheg opened 2 years ago

danicheg commented 2 years ago

I try to use this cURL

curl \
  --request GET \
  --url 'http://localhost:1234/foo' \
  --header 'Cookie: <REDACTED>' \
  --header 'Authorization: <REDACTED>'

and it lead to org.http4s.ParseFailure: Invalid URI: Error(0,NonEmptyList(EndOfString(0,1)))

A variant without newlines works well:

curl --request GET --url 'http://localhost:1234/foo' --header 'Cookie: <REDACTED>' --header 'Authorization: <REDACTED>'

->

{
  import _root_.org.http4s.{Request, Method, Uri, Headers}
  import _root_.fs2.{Stream, Pure}
  Request[Pure](
    method = Method.fromString("GET").fold(throw _, identity),
    uri = Uri.unsafeFromString("--request"),
    headers = Headers(),
    body = Stream()
  )
}

/cc @armanbilge :)

danicheg commented 2 years ago

This came from the discussion https://github.com/http4s/http4s/pull/5786.

armanbilge commented 2 years ago

Actually both inputs are broken: notice that uri is --request and headers is empty. Maybe curly4s doesn't support human-readable flags yet? :)

danicheg commented 2 years ago

Uh-oh. You're right. Haven't checked the output :)