Hello All,

I have been happily using AKKA HTTP for some time, but recently tripped 
over an idiosyncrasy with how it manages URL encoding.

I am writing a client to connect to an S3 storage platform (proprietary 3rd 
party solution).

That platform requires the Plus (+) Symbol to be URL encoded as %2B. 
However, whenever I pass such a string into the HTTP Request constructor 
the underlying URI parser is decoding it to a (+) Symbol and then the 
server S3 storage platform returns a 400.

Example Code:

package org.ingest

import java.net.URLEncoder

import akka.http.scaladsl.model.{HttpMethods, HttpRequest, Uri}

object AkkaHttpExplorer extends App{

  val rootUriString = 
"""https://tenant_1.SimpleStorageService.net/rest/MyFiles/""";
  val fileName = """TopSuggestedGoogle+PagesForYou-2015-12-13.eml"""
  val uriEncoded = URLEncoder.encode(fileName, "utf-8").replace("+", "%2B")
  val fullUri = rootUriString + uriEncoded

  println("What the server needs: " + fullUri)

  val httpReq = HttpRequest(HttpMethods.GET, fullUri)

  println("What Akka Http forces me to send: " + httpReq.uri)
}


Given all the "sealed" classes, I am not getting how I can make this URL 
encoding adjustment with AKKA HTTP.

Most grateful for any guidance,

Christopher

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to