mirror of
https://github.com/square/okhttp.git
synced 2025-07-31 05:04:26 +03:00
Replace !isEmpty with isNotEmpty
This commit is contained in:
@ -103,7 +103,7 @@ class DnsOverHttps internal constructor(builder: Builder) : Dns {
|
||||
|
||||
executeRequests(hostname, networkRequests, results, failures)
|
||||
|
||||
return if (!results.isEmpty()) {
|
||||
return if (results.isNotEmpty()) {
|
||||
results
|
||||
} else {
|
||||
throwBestFailure(hostname, failures)
|
||||
|
@ -357,7 +357,7 @@ class HeldCertificate(private val keyPair: KeyPair, private val certificate: X50
|
||||
BasicConstraints(maxIntermediateCas))
|
||||
}
|
||||
|
||||
if (!altNames.isEmpty()) {
|
||||
if (altNames.isNotEmpty()) {
|
||||
val encodableAltNames = arrayOfNulls<ASN1Encodable>(altNames.size)
|
||||
for (i in 0 until altNames.size) {
|
||||
val altName = altNames[i]
|
||||
|
@ -27,19 +27,15 @@ object RequestLine {
|
||||
* [HttpURLConnection.getHeaderFields], so it needs to be set even if the transport is
|
||||
* HTTP/2.
|
||||
*/
|
||||
fun get(request: Request, proxyType: Proxy.Type): String {
|
||||
val result = StringBuilder()
|
||||
result.append(request.method)
|
||||
result.append(' ')
|
||||
|
||||
fun get(request: Request, proxyType: Proxy.Type) = buildString {
|
||||
append(request.method)
|
||||
append(' ')
|
||||
if (includeAuthorityInRequestLine(request, proxyType)) {
|
||||
result.append(request.url)
|
||||
append(request.url)
|
||||
} else {
|
||||
result.append(requestPath(request.url))
|
||||
append(requestPath(request.url))
|
||||
}
|
||||
|
||||
result.append(" HTTP/1.1")
|
||||
return result.toString()
|
||||
append(" HTTP/1.1")
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,10 +128,10 @@ object Http2 {
|
||||
if (flags == 0) return ""
|
||||
when (type) {
|
||||
// Special case types that have 0 or 1 flag.
|
||||
TYPE_SETTINGS, TYPE_PING -> return if (flags == FLAG_ACK) "ACK" else BINARY[flags]!!
|
||||
TYPE_PRIORITY, TYPE_RST_STREAM, TYPE_GOAWAY, TYPE_WINDOW_UPDATE -> return BINARY[flags]!!
|
||||
TYPE_SETTINGS, TYPE_PING -> return if (flags == FLAG_ACK) "ACK" else BINARY[flags]
|
||||
TYPE_PRIORITY, TYPE_RST_STREAM, TYPE_GOAWAY, TYPE_WINDOW_UPDATE -> return BINARY[flags]
|
||||
}
|
||||
val result = if (flags < FLAGS.size) FLAGS[flags]!! else BINARY[flags]!!
|
||||
val result = if (flags < FLAGS.size) FLAGS[flags]!! else BINARY[flags]
|
||||
// Special case types that have overlap flag values.
|
||||
return when {
|
||||
type == TYPE_PUSH_PROMISE && flags and FLAG_END_PUSH_PROMISE != 0 -> {
|
||||
|
@ -231,7 +231,7 @@ class RealWebSocket(
|
||||
executor!!.scheduleAtFixedRate(
|
||||
PingRunnable(), pingIntervalMillis, pingIntervalMillis, MILLISECONDS)
|
||||
}
|
||||
if (!messageAndCloseQueue.isEmpty()) {
|
||||
if (messageAndCloseQueue.isNotEmpty()) {
|
||||
runWriter() // Send messages that were enqueued before we were connected.
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user