Examples of prepareRequest()


Examples of com.box.restclientv2.requestsbase.DefaultBoxRequest.prepareRequest()

    public void prepareRequestTest() throws AuthFatalFailureException {
        try {
            DefaultBoxRequest request = new DefaultBoxRequest(config, new BoxJSONParser(new BoxResourceHub()), uri, restMethod, null);
            request.addQueryParam("a", "b");
            request.setEntity(requestEntity);
            request.prepareRequest();
            HttpRequestBase rawRequest = request.getRawRequest();
            Assert.assertEquals(HttpPost.class, rawRequest.getClass());
            URI url = rawRequest.getURI();
            Assert.assertEquals(scheme, url.getScheme());
            Assert.assertEquals(host, url.getHost());
View Full Code Here

Examples of com.box.restclientv2.requestsbase.DefaultBoxRequest.prepareRequest()

        String apiKey = "test api key";
        String deviceId = "f9h30fhflzkhg84ghgzhgr534653";
        String deviceName = "Galaxy Death Star";
        DefaultAuthHeaderAuth auth = new DefaultAuthHeaderAuth(token, apiKey, deviceId, deviceName);
        auth.setAuth(request);
        request.prepareRequest();
        Assert.assertEquals(auth.getAuthString().toString(), request.getRawRequest().getHeaders(DefaultAuthHeaderAuth.AUTH_HEADER_NAME)[0].getValue());
    }
}
View Full Code Here

Examples of com.box.restclientv2.requestsbase.DefaultBoxRequest.prepareRequest()

            auth.setAuth(request);
            Map<String, String> queryParams = request.getQueryParams();
            Assert.assertEquals(userName, queryParams.get(DefaultUsernamePasswordAuth.LOGIN));
            Assert.assertEquals(password, queryParams.get(DefaultUsernamePasswordAuth.PASSWORD));

            request.prepareRequest();
            HttpRequestBase rawRequest = request.getRawRequest();
            String query = rawRequest.getURI().getQuery();
            Assert.assertTrue(query.contains(DefaultUsernamePasswordAuth.LOGIN + "=" + userName));
            Assert.assertTrue(query.contains(DefaultUsernamePasswordAuth.PASSWORD + "=" + password));
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.