1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-29 06:23:09 +03:00

Smattering of Kotlin stuff (#5083)

* Migrate sameConnection to extension function

* Migrate bomAwareCharset to extension function

* Migrate verifyAsIpAddress to extension function

* Migrate indexOfControlOrNonAscii to extension function

* Migrate skip(Leading/Trailing)AsciiWhitespace and trimSubstring to extension functions

* Migrate toHeaderBlock to extension function
This commit is contained in:
Jake Wharton
2019-05-20 23:17:37 -04:00
committed by Jesse Wilson
parent 2afc236bf9
commit 42a41f3857
12 changed files with 75 additions and 78 deletions

View File

@@ -81,7 +81,7 @@ class JavaNetCookieJar(private val cookieHandler: CookieHandler) : CookieJar {
while (pos < limit) {
pairEnd = delimiterOffset(header, pos, limit, ";,")
val equalsSign = delimiterOffset(header, pos, pairEnd, '=')
val name = trimSubstring(header, pos, equalsSign)
val name = header.trimSubstring(pos, equalsSign)
if (name.startsWith("$")) {
pos = pairEnd + 1
continue
@@ -89,7 +89,7 @@ class JavaNetCookieJar(private val cookieHandler: CookieHandler) : CookieJar {
// We have either name=value or just a name.
var value = if (equalsSign < pairEnd) {
trimSubstring(header, equalsSign + 1, pairEnd)
header.trimSubstring(equalsSign + 1, pairEnd)
} else {
""
}