Class HttpClient


  • public final class HttpClient
    extends java.lang.Object
    Simple HTTP client wrapper to execute HTTP requests during integration tests. Uses java.net.http HTTP client internally.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @NotNull HttpResponse<java.lang.String> get​(@NotNull java.lang.String url)
      Fetch HTTP content.
      @NotNull java.lang.String getBody​(@NotNull java.lang.String url)
      Fetch HTTP content.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • get

        @NotNull
        public @NotNull HttpResponse<java.lang.String> get​(@NotNull
                                                           @NotNull java.lang.String url)
        Fetch HTTP content. Check status code of response for success.
        Parameters:
        url - URL
        Returns:
        HTTP response.
      • getBody

        @NotNull
        public @NotNull java.lang.String getBody​(@NotNull
                                                 @NotNull java.lang.String url)
        Fetch HTTP content. Fails with exception when request does not return successfully.
        Parameters:
        url - URL
        Returns:
        Body string.