spectator-ext-ipc/src/main/java/com/netflix/spectator/ipc/http/HttpResponse.java [39:101]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private final int status;
  private final Map<String, List<String>> headers;
  private final byte[] data;

  /** Create a new response instance with an empty entity. */
  public HttpResponse(int status, Map<String, List<String>> headers) {
    this(status, headers, HttpUtils.EMPTY);
  }

  /** Create a new response instance. */
  public HttpResponse(int status, Map<String, List<String>> headers, byte[] data) {
    this.status = status;
    Map<String, List<String>> hs = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
    hs.putAll(headers);
    this.headers = Collections.unmodifiableMap(hs);
    this.data = data;
  }

  /** Return the status code of the response. */
  public int status() {
    return status;
  }

  /**
   * Return the headers for the response as an unmodifiable map with case-insensitive keys.
   */
  public Map<String, List<String>> headers() {
    return headers;
  }

  /** Return the value for the first occurrence of a given header or null if not found. */
  public String header(String k) {
    List<String> vs = headers.get(k);
    return (vs == null || vs.isEmpty()) ? null : vs.get(0);
  }

  /**
   * Return the value for a date header. The return value will be null if the header does
   * not exist or if it cannot be parsed correctly as a date.
   */
  public Instant dateHeader(String k) {
    String d = header(k);
    return (d == null) ? null : parseDate(d);
  }

  private Instant parseDate(String d) {
    try {
      return LocalDateTime.parse(d, DateTimeFormatter.RFC_1123_DATE_TIME)
          .atZone(ZoneOffset.UTC)
          .toInstant();
    } catch (Exception e) {
      return null;
    }
  }

  /** Return the entity for the response. */
  public byte[] entity() {
    return data;
  }

  /** Return the entity as a UTF-8 string. */
  public String entityAsString() {
    return new String(data, StandardCharsets.UTF_8);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpResponse.java [39:101]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private final int status;
  private final Map<String, List<String>> headers;
  private final byte[] data;

  /** Create a new response instance with an empty entity. */
  public HttpResponse(int status, Map<String, List<String>> headers) {
    this(status, headers, HttpUtils.EMPTY);
  }

  /** Create a new response instance. */
  public HttpResponse(int status, Map<String, List<String>> headers, byte[] data) {
    this.status = status;
    Map<String, List<String>> hs = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
    hs.putAll(headers);
    this.headers = Collections.unmodifiableMap(hs);
    this.data = data;
  }

  /** Return the status code of the response. */
  public int status() {
    return status;
  }

  /**
   * Return the headers for the response as an unmodifiable map with case-insensitive keys.
   */
  public Map<String, List<String>> headers() {
    return headers;
  }

  /** Return the value for the first occurrence of a given header or null if not found. */
  public String header(String k) {
    List<String> vs = headers.get(k);
    return (vs == null || vs.isEmpty()) ? null : vs.get(0);
  }

  /**
   * Return the value for a date header. The return value will be null if the header does
   * not exist or if it cannot be parsed correctly as a date.
   */
  public Instant dateHeader(String k) {
    String d = header(k);
    return (d == null) ? null : parseDate(d);
  }

  private Instant parseDate(String d) {
    try {
      return LocalDateTime.parse(d, DateTimeFormatter.RFC_1123_DATE_TIME)
          .atZone(ZoneOffset.UTC)
          .toInstant();
    } catch (Exception e) {
      return null;
    }
  }

  /** Return the entity for the response. */
  public byte[] entity() {
    return data;
  }

  /** Return the entity as a UTF-8 string. */
  public String entityAsString() {
    return new String(data, StandardCharsets.UTF_8);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



