Package com.github.kevwil.aspen.domain

Examples of com.github.kevwil.aspen.domain.Response


    @Test
    public void shouldWriteBodyToResponse()
    {
        replay( _app );
        Response response = new Response( r );
        String data = "line one\r\nline two\r\nline three";
        RubyString body = RubyString.newString( _runtime, data );

        _rack.writeBodyToResponse( body, response );

        assertTrue( response.hasBody() );
        assertFalse( response.hasException() );
        assertEquals( data, response.getBody().toString() );
    }
View Full Code Here


        cookies.put( "bar_content", "bar" );
        headers.put( "Cookie", cookies );
        array.add( headers );
        array.add( "Hello World!" );

        Response response = _rack.createResponse( r, array );

        assertNotNull( response );
        assertTrue( response.hasBody() );
        assertFalse( response.hasException() );
        assertEquals( 200, response.getResponseStatus().getCode() );
        assertFalse( response.getHeaderNames().isEmpty() );
        assertEquals( "Hello World!", response.getBody().toString() );
    }
View Full Code Here

                                 eq( "call" ),
                                 anyObject( IRubyObject[].class ),
                                 eq( Block.NULL_BLOCK ) ) ).andReturn( array );
        replay( _app );

        Response response = _rack.process( r );
        assertNotNull( response );
        assertTrue( response.hasBody() );
        assertFalse( response.hasException() );
        assertEquals( 200, response.getResponseStatus().getCode() );
        assertFalse( response.getHeaderNames().isEmpty() );
        assertEquals( "Hello World!", response.getBody().toString() );
    }
View Full Code Here

        HttpRequest hr = new DefaultHttpRequest( HttpVersion.HTTP_1_1, HttpMethod.GET, "http://localhost/" );
        MessageEvent e = new UpstreamMessageEvent(
                channel, hr, new InetSocketAddress( 54321 ) );
        ChannelHandlerContext ctx = RackUtil.buildDummyChannelHandlerContext( "localhost", "80" );
        Request request = createMockBuilder( Request.class ).withConstructor( ctx, hr, Ruby.getGlobalRuntime() ).createMock();
        Response response = new Response( request );

        expect( rack.getRuntime() ).andReturn( Ruby.getGlobalRuntime() );
        expect( rack.process( anyObject( Request.class ) ) ).andReturn( response );
        replay( request );
        replay( rack );
View Full Code Here

TOP

Related Classes of com.github.kevwil.aspen.domain.Response

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.