Package org.vertx.java.core

Examples of org.vertx.java.core.MultiMap


                        assertEquals(200, resp.getStatusCode());
                        final String cookie = resp.headers.get("set-cookie");
                        assertNotNull(cookie);

                        // make a new request to / with cookie should return again the same cookie
                        MultiMap headers = new CaseInsensitiveMultiMap();
                        headers.add("cookie", cookie);

                        yokeAssert.request("GET", "/", headers, new Handler<Response>() {
                            @Override
                            public void handle(Response resp) {
                                // the session should be the same, so no set-cookie
                                assertEquals(200, resp.getStatusCode());
                                String nocookie = resp.headers.get("set-cookie");
                                assertNull(nocookie);

                                // end the session
                                MultiMap headers = new CaseInsensitiveMultiMap();
                                headers.add("cookie", cookie);

                                yokeAssert.request("GET", "/delete", headers, new Handler<Response>() {
                                    @Override
                                    public void handle(Response resp) {
                                        // there should be a set-cookie with maxAge 0
View Full Code Here


                request.response().end();
                fail();
            }
        });

        MultiMap headers = new CaseInsensitiveMultiMap();
        headers.add("host", "www.mycorp.com");

        new YokeTester(yoke).request("GET", "/", headers, new Handler<Response>() {
            @Override
            public void handle(Response resp) {
            }
View Full Code Here

            }
        });

        Buffer body = new Buffer(json.encode());

        MultiMap headers = new CaseInsensitiveMultiMap();
        headers.add("content-type", "application/json");
        headers.add("content-length", Integer.toString(body.length()));

        new YokeTester(yoke).request("POST", "/upload", headers, body, new Handler<Response>() {
            @Override
            public void handle(Response resp) {
                assertEquals(200, resp.getStatusCode());
View Full Code Here

        Yoke yoke = new Yoke(this);
        yoke.use(new Handler<YokeRequest>() {
            @Override
            public void handle(YokeRequest request) {
                MultiMap body = request.formAttributes();
                assertEquals("value", body.get("param"));
                request.response().end();
            }
        });

        Buffer body = new Buffer("param=value");

        MultiMap headers = new CaseInsensitiveMultiMap();
        headers.add("content-type", "application/x-www-form-urlencoded");
        headers.add("content-length", Integer.toString(body.length()));

        new YokeTester(yoke).request("POST", "/upload", headers, body, new Handler<Response>() {
            @Override
            public void handle(Response resp) {
                assertEquals(200, resp.getStatusCode());
View Full Code Here

            }
        });

        Buffer body = new Buffer("hello-world");

        MultiMap headers = new CaseInsensitiveMultiMap();
        headers.add("content-length", Integer.toString(body.length()));

        new YokeTester(yoke).request("POST", "/upload", headers, body, new Handler<Response>() {
            @Override
            public void handle(Response resp) {
                assertEquals(200, resp.getStatusCode());
View Full Code Here

            }
        });

        Buffer body = new Buffer("[1,2,3,4,5]");

        MultiMap headers = new CaseInsensitiveMultiMap();
        headers.add("content-type", "application/json");
        headers.add("transfer-encoding", "chunked");

        new YokeTester(yoke).request("POST", "/upload", headers, body, new Handler<Response>() {
            @Override
            public void handle(Response resp) {
                assertEquals(413, resp.getStatusCode());
View Full Code Here

            }
        });

        Buffer body = new Buffer("hello world");

        MultiMap headers = new CaseInsensitiveMultiMap();
        headers.add("content-type", "plain/text");
        headers.add("transfer-encoding", "chunked");

        new YokeTester(yoke).request("POST", "/upload", headers, body, new Handler<Response>() {
            @Override
            public void handle(Response resp) {
                assertEquals(413, resp.getStatusCode());
View Full Code Here

            }
        });

        Buffer body = new Buffer("hello=world");

        MultiMap headers = new CaseInsensitiveMultiMap();
        headers.add("content-type", HttpHeaders.Values.APPLICATION_X_WWW_FORM_URLENCODED);
        headers.add("transfer-encoding", "chunked");

        new YokeTester(yoke).request("POST", "/upload", headers, body, new Handler<Response>() {
            @Override
            public void handle(Response resp) {
                assertEquals(413, resp.getStatusCode());
View Full Code Here

                request.response().setStatusCode(204);
                request.response().end("");
            }
        });

        MultiMap headers = new CaseInsensitiveMultiMap();
        headers.add("Content-Type", "application/json");
        headers.add("Content-Length", "0");

        new YokeTester(yoke).request("DELETE", "/delete", headers, new Handler<Response>() {
            @Override
            public void handle(Response resp) {
                assertEquals(204, resp.getStatusCode());
View Full Code Here

        yoke.use(new BodyParser());
        yoke.use(com.jetdrone.vertx.yoke.middleware.Router.from(new R3()));

        Buffer body = new Buffer("{}");

        MultiMap headers = new CaseInsensitiveMultiMap();
        headers.add("content-type", "application/json");
        headers.add("content-length", Integer.toString(body.length()));

        new YokeTester(yoke).request("POST", "/api", headers, body, new Handler<Response>() {
            @Override
            public void handle(Response resp) {
                assertEquals(400, resp.getStatusCode());
View Full Code Here

TOP

Related Classes of org.vertx.java.core.MultiMap

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.