private Response call(Method method, String endpoint, Request params, File inputFile) {
        StringBuilder action = new StringBuilder();
        action.append("Making <i>");
        action.append(method.toString());
        action.append("</i> call to <i>");
        action.append(http.getServiceBaseUrl()).append(endpoint).append(http.getRequestParams(params));
        action.append("</i>");
        action.append("<div class='indent'>");
        action.append(Reporter.getCredentialStringOutput(http));
        action.append(Reporter.getRequestHeadersOutput(http));
        action.append(Reporter.getRequestPayloadOutput(params, inputFile));
        action.append("</div>");
        String expected = "<i>" + method + "</i> call was performed";
        Response response = null;
        try {
            switch (method) {
                case GET:
                    response = http.get(endpoint, params);
                    break;
                case POST:
                    response = http.post(endpoint, params, inputFile);
                    break;
                case PUT:
                    response = http.put(endpoint, params, inputFile);
                    break;
                case DELETE:
                    response = http.delete(endpoint, params, inputFile);
                    break;
            }
            String actual = expected;
            actual += "<div class='indent'>";
            actual += Reporter.getResponseHeadersOutput(response);
            actual += Reporter.getResponseCodeOutput(response);
            actual += Reporter.getResponseOutput(response);
            actual += "</div>";
            reporter.pass(action.toString(), expected, actual);
        } catch (Exception e) {
            reporter.fail(action.toString(), expected, "<i>" + method + "</i> call failed. " + e.getMessage());
        }
        return response;
    }
private Response call ( Method method , String endpoint , Request params , File inputFile ) { StringBuilder action = new StringBuilder ( ) ; action . append ( "Making <i>" ) ; action . append ( method . toString ( ) ) ; action . append ( "</i> call to <i>" ) ; action . append ( http . getServiceBaseUrl ( ) ) . append ( endpoint ) . append ( http . getRequestParams ( params ) ) ; action . append ( "</i>" ) ; action . append ( "<div class='indent'>" ) ; action . append ( Reporter . getCredentialStringOutput ( http ) ) ; action . append ( Reporter . getRequestHeadersOutput ( http ) ) ; action . append ( Reporter . getRequestPayloadOutput ( params , inputFile ) ) ; action . append ( "</div>" ) ; String expected = "<i>" + method + "</i> call was performed" ; Response response = null ; try { switch ( method ) { case GET : response = http . get ( endpoint , params ) ; break ; case POST : response = http . post ( endpoint , params , inputFile ) ; break ; case PUT : response = http . put ( endpoint , params , inputFile ) ; break ; case DELETE : response = http . delete ( endpoint , params , inputFile ) ; break ; } String actual = expected ; actual += "<div class='indent'>" ; actual += Reporter . getResponseHeadersOutput ( response ) ; actual += Reporter . getResponseCodeOutput ( response ) ; actual += Reporter . getResponseOutput ( response ) ; actual += "</div>" ; reporter . pass ( action . toString ( ) , expected , actual ) ; } catch ( Exception e ) { reporter . fail ( action . toString ( ) , expected , "<i>" + method + "</i> call failed. " + e . getMessage ( ) ) ; } return response ; }
Performs an http call and writes the call and response information to the
output file

@param method     - what http method call is being made. should be in all caps
@param endpoint - the endpoint of the service under test
@param params   - the parameters to be passed to the endpoint for the service
call
@return Response: the response provided from the http call