I'm using Dispatch from Scala as follows:
val body = """{"count":5,"requeue":true,"encoding":"auto","truncate":50000}"""
val req = url("http://localhost:4567/api/queues/%2f/myQueue/get").as_!("guest", "guest") << (body, "application/json")
val http = new Http
val resp = http(req as_str)
The %2f
gets turned into a /
, so it tries to post to /api/queues///myQueue/get
rather than to /api/queues/%2f/myQueue/get
.
How do I escape this properly?
% sign is used in url encoding. So, %2f gets decoded into /. try it on browser and you will see.
Use %25 to represent % sign. e.g.
val req = url("http://localhost:4567/api/queues/%252f/myQueue/get")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With