2012-10-09 58 views

回答

1

這只是玩2.3.x版本可用,但MockWS客戶端可用:https://github.com/leanovate/play-mockws

val ws = MockWS { 
    case (GET, "http://dns/url") => Action { Ok("http response") } 
} 

await(ws.url("http://dns/url").get()).body == "http response" 
+0

我怎麼會在播放2.3.x版本做到這一點? – cnmuc

+0

源代碼中有一個示例:https://github.com/leanovate/play-mockws/blob/master/src%2Ftest%2Fscala%2Fmockws%2FExample.scala –