Play 2.6 - users may still use the depracated Action
See original GitHub issueHi,
Despite the library now compiling without warnings, users that use it may still run into depracated warnings whenever they use it:
import mockws.MockWS
import play.api.mvc.Results.Ok
import play.api.mvc.Action
val ws = MockWS {
case (GET, "http://www.example.com") => Action { Ok("homepage") }
}
Will cause:
Warning:(30, 49) object Action in package mvc is deprecated (since 2.6.0): Inject an ActionBuilder (e.g. DefaultActionBuilder) or extend BaseController/AbstractController/InjectedController
case (GET, "http://www.example.com") => Action { Ok("homepage") }
Maybe it’s a good idea to provide a helper action that the users can import and use without warnings:
import play.api.mvc.{AnyContentAsEmpty, DefaultActionBuilder}
import play.api.test.Helpers.stubBodyParser
import scala.concurrent.ExecutionContext
object MockWS {
val Action: DefaultActionBuilder = DefaultActionBuilder(stubBodyParser(AnyContentAsEmpty))(ExecutionContext.global)
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Play 2.6 Migration Guide - Documentation
The play.api.mvc.Action global object and BodyParsers#parse are now deprecated. They are replaced by injectable traits, DefaultActionBuilder and ...
Read more >PlayFramework migration 2.5.x to 2.6.x deprecated Action.async
Trying to migrate from 2.5.x to 2.6.x. I have trait Secured with old method IsAuthenticatedAsync, i'm trying to write new method ...
Read more >Play 2.6 Security Analysis - nVisium Blog
Play 2.6 introduces several new security filters that aim to make applications more inherently secure out of the box. They will also make...
Read more >Migration Guide 2.5.x to 2.6.x • Akka Documentation
If you are still using Scala 2.11 then you must upgrade to 2.12 or 2.13 ... Classic remoting is deprecated but can be...
Read more >Reactive Scala Driver for MongoDB - ReactiveMongo
Play has deprecated the plugins in version 2.4, therefore it is recommended to remove the former ReactiveMongoPlugin from your project. It must be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @yanns here’s a sketch: https://github.com/leanovate/play-mockws/pull/30 Feedback welcome! Thanks, Raphael
this is how we currently work around this for specs2