scala - Secured trait causing spec2 unit test compilation errors -
I have implemented authorization for my Play Framework (version 2.3.5) application:
< Code> Properties Secure (Deaf Username (Request: Request Header) = request.session.get (Security Username) Unofficial (Request: Request Header) = DF on Def.Redirect (routes.login.index) Def withAuth (f: = & Gt; String = & gt; Request [AnyContent] = & gt; Results) = {Security.Authenticated (username, on unauthorized) {user => However, when I decorate my controller functions with the withAuth function, this works like this: (f (request = & gt; f (user) (request))}}} CSV ") .Winders (CONTENT_DISPOSITION -> (" attachment; file name = export CSV "), CONTENT_LENGTH -> csv.length.toString)}
Compilation errors in 2 unit tests They are: {val controller = "export data in the form of CSV" in new controllers
Datacentor val output = Controller ("attachment; File name = export.csv ")}} Apply (FakeRequest ()) should be the header (the result) Pair (" content-displacement "-> the following compiler error message With the header fails to call the test assistant function: type mismatch; found: play.api.libs.iteratee.irateatee [array [byte], Play.api.mvc.Result] Required: scala.concurrent.future [play.api.mvc.Result]
Am I doing something wrong? I tried some stackwaveflow users It's all but body Type rely on setting, but my actions do not have a body type.
It seems as if some sort of action is being wrapped with So, maybe there is a more secure way to express the safe property?
Try to change this:
val result = controller.) .apply (FakeRequest ()) In: < Pre> val result = controller Export (). Applied (FakeRequest ()). And then it should work.
Comments
Post a Comment