Package play.api.mvc

Examples of play.api.mvc.AnyContentAsJson


     * The <tt>Content-Type</tt> header of the request is set to <tt>application/json</tt>.
     * @param json the JsValue
     * @return the Fake Request
     */
    public FakeRequest withJsonBody(JsValue json) {
        return withAnyContent(new AnyContentAsJson(json), "application/json", this.fake.getMethod());
    }
View Full Code Here


        if (method == null) {
            method = Helpers.POST;
        }
        Map<String, Seq<String>> map = new HashMap<String, Seq<String>>(Scala.asJava(fake.headers().toMap()));
        map.put("Content-Type", Scala.toSeq(new String[] {"application/json"}));
        AnyContentAsJson content =
            new AnyContentAsJson(play.api.libs.json.JacksonJson$.MODULE$.jsonNodeToJsValue(node));
        fake = new play.api.test.FakeRequest(method, fake.uri(), new play.api.test.FakeHeaders(Scala.asScala(map).toSeq()), content, fake.remoteAddress(), fake.version(), fake.id(), fake.tags(), fake.secure());
        return this;
    }
View Full Code Here

     * @param json the JsValue
     * @param method the HTTP method. <tt>POST</tt> if set to <code>null</code>
     * @return the Fake Request
     */
    public FakeRequest withJsonBody(JsValue json, String method) {
        return withAnyContent(new AnyContentAsJson(json), "application/json", method);
    }
View Full Code Here

TOP

Related Classes of play.api.mvc.AnyContentAsJson

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.