vmtest/src/test/java/org/apidesign/bck2brwsr/tck/HttpResourceTest.java
branchemul
changeset 625 8efbe49b283f
parent 624 e79ab81a7656
child 626 f08eb4df84c1
     1.1 --- a/vmtest/src/test/java/org/apidesign/bck2brwsr/tck/HttpResourceTest.java	Thu Jan 31 18:22:14 2013 +0100
     1.2 +++ b/vmtest/src/test/java/org/apidesign/bck2brwsr/tck/HttpResourceTest.java	Thu Jan 31 18:45:00 2013 +0100
     1.3 @@ -54,6 +54,17 @@
     1.4          assert "Hello via URL!".equals(msg) : "The message was " + msg;
     1.5          return msg;
     1.6      }
     1.7 +
     1.8 +    @HttpResource(path = "/bytes", content = "\u00fe", mimeType = "x-application/binary")
     1.9 +    @BrwsrTest
    1.10 +    public void testReadByte() throws Exception {
    1.11 +        URL url = new URL("http:/bytes");
    1.12 +        final Object res = url.getContent(new Class[] { byte[].class });
    1.13 +        assert res instanceof byte[] : "Expecting byte[]: " + res;
    1.14 +        byte[] arr = (byte[]) res;
    1.15 +        assert arr.length == 1 : "One byte " + arr.length;
    1.16 +        assert arr[0] == 0xfe : "It is 0xfe: " + Integer.toHexString(arr[0]);
    1.17 +    }
    1.18      
    1.19      @JavaScriptBody(args = { "url" }, body = 
    1.20            "var req = new XMLHttpRequest();\n"