Skip to content

Commit

Permalink
Convert Header to a data class
Browse files Browse the repository at this point in the history
  • Loading branch information
amirlivneh committed Mar 31, 2019
1 parent 6f35c2d commit 2b3cc34
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions okhttp/src/main/java/okhttp3/internal/http2/Header.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import okio.ByteString
import okio.ByteString.Companion.encodeUtf8

/** HTTP header: the name is an ASCII string, but the value can be UTF-8. */
class Header(
data class Header(
/** Name in case-insensitive ASCII encoding. */
@JvmField val name: ByteString,
/** Value in UTF-8 encoding. */
Expand All @@ -33,19 +33,6 @@ class Header(

constructor(name: ByteString, value: String) : this(name, value.encodeUtf8())

override fun equals(other: Any?): Boolean {
return other is Header
&& this.name == other.name
&& this.value == other.value
}

override fun hashCode(): Int {
var result = 17
result = 31 * result + name.hashCode()
result = 31 * result + value.hashCode()
return result
}

override fun toString(): String {
return Util.format("%s: %s", name.utf8(), value.utf8())
}
Expand Down

0 comments on commit 2b3cc34

Please sign in to comment.