scala - Getting a 302 http redirect location with Databinder-Dispatch -
with databinder-dispatch 0.8.3 i'm trying redirect url 302 http response, following exception:
caused by: dispatch.statuscode: unexpected response code: 302
here's i've attempted, some help:
import dispatch._ import org.apache.http.{httprequest,httpresponse} import org.apache.http.protocol.httpcontext import org.apache.http.httpstatus._ val http = new http { override def make_client = { val client = new configuredhttpclient(new http.currentcredentials(none)) client.setredirectstrategy(new org.apache.http.impl.client.defaultredirectstrategy { override def isredirected(req: httprequest, res: httpresponse, ctx: httpcontext) = false }) client } } val req: request = :/("graph.facebook.com") / "kmels" / "picture" val pictureurl: string = http(req.secure >:> { _("location").head }) //error prone code, we're testing. line exception thrown.
what missing? always, in advance.
the following works:
val pictureurl: string = http.x(req.secure >:> { _("location").head })
Comments
Post a Comment