larksuite-oapi/src/main/java/com/larksuite/oapi/okhttp3_14/internal/http2/Http2ExchangeCodec.java
public static Response.Builder readHttp2HeadersList(Headers headerBlock,
                                                      Protocol protocol) throws IOException {
    StatusLine statusLine = null;
    Headers.Builder headersBuilder = new Headers.Builder();
    for (int i = 0, size = headerBlock.size(); i < size; i++) {
      String name = headerBlock.name(i);
      String value = headerBlock.value(i);
      if (name.equals(RESPONSE_STATUS_UTF8)) {
        statusLine = StatusLine.parse("HTTP/1.1 " + value);
      } else if (!HTTP_2_SKIPPED_RESPONSE_HEADERS.contains(name)) {
        Internal.instance.addLenient(headersBuilder, name, value);
      }
    }
    if (statusLine == null) throw new ProtocolException("Expected ':status' header not present");

    return new Response.Builder()
        .protocol(protocol)
        .code(statusLine.code)
        .message(statusLine.message)
        .headers(headersBuilder.build());
  }
/** Returns headers for a name value block containing an HTTP/2 response. */
Returns headers for a name value block containing an HTTP/2 response.
Returns headers for a name value block containing an HTTP / 2 response .
public static Response.Builder readHttp2HeadersList(Headers headerBlock,
                                                      Protocol protocol) throws IOException {
    StatusLine statusLine = null;
    Headers.Builder headersBuilder = new Headers.Builder();
    for (int i = 0, size = headerBlock.size(); i < size; i++) {
      String name = headerBlock.name(i);
      String value = headerBlock.value(i);
      if (name.equals(RESPONSE_STATUS_UTF8)) {
        statusLine = StatusLine.parse("HTTP/1.1 " + value);
      } else if (!HTTP_2_SKIPPED_RESPONSE_HEADERS.contains(name)) {
        Internal.instance.addLenient(headersBuilder, name, value);
      }
    }
    if (statusLine == null) throw new ProtocolException("Expected ':status' header not present");
    return new Response.Builder()
        .protocol(protocol)
        .code(statusLine.code)
        .message(statusLine.message)
        .headers(headersBuilder.build());
  }
public static Response . Builder readHttp2HeadersList ( Headers headerBlock , Protocol protocol ) throws IOException { StatusLine statusLine = null ; Headers . Builder headersBuilder = new Headers . Builder ( ) ; for ( int i = 0 , size = headerBlock . size ( ) ; i < size ; i ++ ) { String name = headerBlock . name ( i ) ; String value = headerBlock . value ( i ) ; if ( name . equals ( RESPONSE_STATUS_UTF8 ) ) { statusLine = StatusLine . parse ( "HTTP/1.1 " + value ) ; } else if ( ! HTTP_2_SKIPPED_RESPONSE_HEADERS . contains ( name ) ) { Internal . instance . addLenient ( headersBuilder , name , value ) ; } } if ( statusLine == null ) throw new ProtocolException ( "Expected ':status' header not present" ) ; return new Response . Builder ( ) . protocol ( protocol ) . code ( statusLine . code ) . message ( statusLine . message ) . headers ( headersBuilder . build ( ) ) ; }
Returns headers for a name value block containing an HTTP/2 response.
Returns headers for a name value block containing an HTTP / 2 response .