Buscar pacotes, repositórios e categorias de apps

Repositório GitHubdart-archive/http2

http2

Uma implementação de HTTP/2 para Dart.

Capa do projeto http2
Estrelas
150
Forks
45
Último push (UTC)
21 de out. de 2024
Status do projeto
Arquivado

README original

Texto original em inglês. Visite o GitHub para a versão atual.

[!IMPORTANT]
This repo has moved to https://github.com/dart-lang/http/tree/master/pkgs/http2

Dart CI pub package package publisher

This library provides an http/2 interface on top of a bidirectional stream of bytes.

Usage

Here is a minimal example of connecting to a http/2 capable server, requesting a resource and iterating over the response.

import 'dart:convert';
import 'dart:io';

import 'package:http2/http2.dart';

Future<void> main() async {
  final uri = Uri.parse('https://www.google.com/');

  final transport = ClientTransportConnection.viaSocket(
    await SecureSocket.connect(
      uri.host,
      uri.port,
      supportedProtocols: ['h2'],
    ),
  );

  final stream = transport.makeRequest(
    [
      Header.ascii(':method', 'GET'),
      Header.ascii(':path', uri.path),
      Header.ascii(':scheme', uri.scheme),
      Header.ascii(':authority', uri.host),
    ],
    endStream: true,
  );

  await for (var message in stream.incomingMessages) {
    if (message is HeadersStreamMessage) {
      for (var header in message.headers) {
        final name = utf8.decode(header.name);
        final value = utf8.decode(header.value);
        print('Header: $name: $value');
      }
    } else if (message is DataStreamMessage) {
      // Use [message.bytes] (but respect 'content-encoding' header)
    }
  }
  await transport.finish();
}

An example with better error handling is available here.

See the API docs for more details.

Features and bugs

Please file feature requests and bugs at the issue tracker.

Dart Archive GitHub avatar
Autor no GitHub

Dart Archive ↗

Legacy projects kept around for posterity – See github.com/dart-lang for current work

LinguagensDart

Dependências usadas

Lista de dependências 4 itens

  • build_runnerDesenvolvimento^2.3.0
  • dart_flutter_team_lintsDesenvolvimento^2.0.0
  • mockitoDesenvolvimento^5.3.2
  • testDesenvolvimento^1.21.4

Como escolher um repositório para seu projeto?

Filtre pelo caso de uso, compare a atividade e confira o projeto original antes de adotá-lo.

  1. Busque por nome, autor ou descrição e filtre por tema.
  2. Compare estrelas, forks e envios recentes. Estrelas indicam interesse, mas não garantem qualidade.
  3. Confira o README, a licença e as issues no GitHub antes de usar o projeto.

Fontes e manutenção

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗