Class GenericRequest

  • All Implemented Interfaces:
    khttp.requests.Request

    
    public final class GenericRequest
     implements Request
                        
    • Constructor Detail

    • Method Detail

      • getUrl

         String getUrl()

        The URL to perform this request on.

      • getData

         Object getData()

        The data for the body of this request.

      • getJson

         Object getJson()

        An object to use as the JSON payload for this request. Some special things happen if this isn't null.

        If this is not null,

        • whatever is specified in data will be overwritten

        • the Content-Type header becomes application/json

        • the object specified is coerced into either a JSONArray or a JSONObject

        • JSONObjects and JSONArrays are treated as such and will not undergo coercion

        • Maps become JSONObjects by using the appropriate constructor. Keys are converted to Strings, with null becoming "null"

        • Collections becomes JSONArrays by using the appropriate constructor.

        • Arrays become JSONArrays by using the appropriate constructor.

        • any other Iterables becomes JSONArrays using a custom method.

        • any other object throws an IllegalArgumentException

      • getCookies

         Map<String, String> getCookies()

        A Map of cookies to send with this request. Note that CookieJar is a map. It also has a constructor that takes a map, for easy conversion.

      • getTimeout

         Double getTimeout()

        The amount of time to wait, in seconds, for the server to send data.

      • getStream

         Boolean getStream()

        If the response content should be immediately downloaded (false) or streamed (true).