Skip to content

okhttp / okhttp3 / HttpUrl / queryParameterValue


fun queryParameterValue(index:Int):String?

Returns the value of the query parameter at index. For example this returns "apple" for queryParameterName(0) on http://host/?a=apple&b=banana. This throws if index is not less than the query size.

URL queryParameterValue(0) queryParameterValue(1)
http://host/ exception exception
http://host/? null exception
http://host/?a=apple&k=key+lime "apple" "key lime"
http://host/?a=apple&a=apricot "apple" "apricot"
http://host/?a=apple&b "apple" null