Class Http

java.lang.Object
edu.tufts.hrilab.util.Http

public class Http extends Object
  • Field Details

    • log

      protected static org.slf4j.Logger log
  • Constructor Details

    • Http

      public Http()
  • Method Details

    • sendGetRequest

      public static String sendGetRequest(String endpointUrl, Map<String,String> headers)
      Returns the JSON string response from an endpoint via GET.
      Parameters:
      endpointUrl - URL, including path, to make request to
      headers - Headers for request in a map
      Returns:
      Response from the endpoint as JSON string
    • sendPostRequest

      public static String sendPostRequest(String endpointUrl, Object requestBody, Map<String,String> headers)
      Returns the JSON string response from an endpoint via POST.
      Parameters:
      endpointUrl - URL, including path, to make request to
      requestBody - Body payload of request
      headers - Headers for request in a map
      Returns:
      Response from the endpoint as JSON string