Class HttpRequest.Builder

  • Enclosing class:
    HttpRequest

    public static class HttpRequest.Builder
    extends Object
    Provides a Nitric request builder class.
    Since:
    1.0
    • Method Detail

      • method

        public HttpRequest.Builder method​(String method)
        Set the request method, for example with HTTP this would be ["GET" | "POST" | "PUT" | "DELETE" ].
        Parameters:
        method - the request method
        Returns:
        the request builder instance
      • path

        public HttpRequest.Builder path​(String path)
        Set the request path.
        Parameters:
        path - the request path
        Returns:
        the request builder instance
      • query

        public HttpRequest.Builder query​(String query)
        Set the request URL query.
        Parameters:
        query - the request URL query
        Returns:
        the request builder instance
      • headers

        public HttpRequest.Builder headers​(Map<String,​List<String>> headers)
        Set the request headers.
        Parameters:
        headers - the request headers
        Returns:
        the request builder instance
      • body

        public HttpRequest.Builder body​(byte[] body)
        Set the request body.
        Parameters:
        body - the request body
        Returns:
        the request builder instance.
      • build

        public HttpRequest build()
        Returns:
        a new HTTP response.