com.undefinedlabs.scope.deps.okhttp3.internal.http2.Header Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scope-deps Show documentation
Show all versions of scope-deps Show documentation
Scope is a APM for tests to give engineering teams unprecedented visibility into their CI process to quickly
identify, troubleshoot and fix failed builds.
This artifact contains dependencies for Scope.
package com.undefinedlabs.scope.deps.okhttp3.internal.http2;
import com.undefinedlabs.scope.deps.okhttp3.internal.Util;
import com.undefinedlabs.scope.deps.okio.ByteString;
public final class Header {
// Special header names defined in HTTP/2 spec.
public static final ByteString PSEUDO_PREFIX = ByteString.encodeUtf8(":");
public static final ByteString RESPONSE_STATUS = ByteString.encodeUtf8(":status");
public static final ByteString TARGET_METHOD = ByteString.encodeUtf8(":method");
public static final ByteString TARGET_PATH = ByteString.encodeUtf8(":path");
public static final ByteString TARGET_SCHEME = ByteString.encodeUtf8(":scheme");
public static final ByteString TARGET_AUTHORITY = ByteString.encodeUtf8(":authority");
/** Name in case-insensitive ASCII encoding. */
public final ByteString name;
/** Value in UTF-8 encoding. */
public final ByteString value;
final int hpackSize;
// TODO: search for toLowerCase and consider moving logic here.
public Header(String name, String value) {
this(ByteString.encodeUtf8(name), ByteString.encodeUtf8(value));
}
public Header(ByteString name, String value) {
this(name, ByteString.encodeUtf8(value));
}
public Header(ByteString name, ByteString value) {
this.name = name;
this.value = value;
this.hpackSize = 32 + name.size() + value.size();
}
@Override public boolean equals(Object other) {
if (other instanceof Header) {
Header that = (Header) other;
return this.name.equals(that.name)
&& this.value.equals(that.value);
}
return false;
}
@Override public int hashCode() {
int result = 17;
result = 31 * result + name.hashCode();
result = 31 * result + value.hashCode();
return result;
}
@Override public String toString() {
return Util.format("%s: %s", name.utf8(), value.utf8());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy