HttpUrlBuilder

Methods
18
Fields
None

Getting one

HttpUrlBuilder.new()
HttpUrl.get(…):newBuilder()

Methods

MethodReturnsDescription
scheme(string)HttpUrlBuilderhttp or https; anything else is IllegalArgumentException.
host(string)HttpUrlBuilderThe host; one OkHttp cannot canonicalize is IllegalArgumentException.
port(number)HttpUrlBuilderThe port, 1 to 65535.
username(string)HttpUrlBuilderThe user name.
password(string)HttpUrlBuilderThe password.
addPathSegment(string)HttpUrlBuilderOne path segment (a / in it is encoded); .. removes the last.
addPathSegments(string)HttpUrlBuilder/-separated path segments.
addEncodedPathSegment(string)HttpUrlBuilderOne path segment, already encoded.
addEncodedPathSegments(string)HttpUrlBuilderPath segments, already encoded.
encodedPath(string)HttpUrlBuilderThe whole path, encoded, starting with /.
query(string?)HttpUrlBuilderThe whole query (nil for none).
addQueryParameter(string, string?)HttpUrlBuilderOne more query parameter (value nil for a bare name).
addEncodedQueryParameter(string, string?)HttpUrlBuilderOne more query parameter, already encoded.
setQueryParameter(string, string?)HttpUrlBuilderReplace every value of name with this one, at the end.
removeAllQueryParameters(string)HttpUrlBuilderRemove every value of name.
fragment(string?)HttpUrlBuilderThe fragment (nil for none).
build()HttpUrlThe URL; without a scheme or host it is IllegalStateException.
new()HttpUrlBuilderAn empty builder.

Returned by

MethodReturnsDescription
HttpUrl.newBuilderHttpUrlBuilderA builder holding this URL.
HttpUrlBuilderClass.newHttpUrlBuilderAn empty builder.

Method details