Why aren't query parameters being percent encoded when using Uri.toString

61 views
Skip to first unread message

Zack Angelo

unread,
May 25, 2014, 7:32:58 PM5/25/14
to spray...@googlegroups.com
I'm using this snippet of code to construct a Uri:
 
import spray.http.Uri

  val redirectUri = Uri(s"http://localhost/oauth/complete")
  val authorizeUri =
      .withQuery(
        "response_type" -> "code",
        "client_id"     -> "xxx",
        "redirect_uri"  -> redirectUri.toString)

  println(s"authorize uri = ${authorizeUri.toString}")

----


The Uris are being generated, but the redirect_uri query parameter isn't being percent-encoded. 

Is there another method I should be using besides .toString() to get the encoded form of the query parameters? 

Just to give a bit of context, I'm sending authorizeUri out to a redirect. But when I inspect the response using curl, the redirect_uri parameter in the Location header and body isn't encoded there, either. 
 

Mathias Doenitz

unread,
May 26, 2014, 6:15:19 AM5/26/14
to spray...@googlegroups.com
Zack,
for most things URI-related spray follows RFC3986 (http://tools.ietf.org/html/rfc3986), which doesn’t require any percent encoding in your example.
What output would expect?

Cheers,
Mathias

---
mat...@spray.io
http://spray.io
> --
> You received this message because you are subscribed to the Google Groups "spray.io User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to spray-user+...@googlegroups.com.
> Visit this group at http://groups.google.com/group/spray-user.
> To view this discussion on the web visit https://groups.google.com/d/msgid/spray-user/6c8b9dd1-8831-4c52-9f6c-db4d4aa96c9a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages