Skip to main content

relic_headers 2.0.0-rc.5 copy "relic_headers: ^2.0.0-rc.5" to clipboard
relic_headers: ^2.0.0-rc.5 copied to clipboard

HTTP header names and stores shared by Relic adapters and other packages.

relic_headers #

HTTP header names and stores, shared by Relic's server adapters and by any package that reads or produces HTTP headers without wanting the rest of Relic.

  • HeaderName interns the standard header names. A known name has a stable small id, so a store can index it without hashing strings, and the same table is generated for the native parser, which hands the id over.
  • HeaderStore is what a server adapter hands the framework for a request. It is a base class with four abstract members, so it can grow without breaking implementers.
  • MutableHeaderStore is what a response is built in. Every writer rejects CR, LF and NUL in a value.
  • MapHeaderStore is the plain map implementation of both.
import 'package:relic_headers/relic_headers.dart';

final headers = MapHeaderStore()
  ..set(HeaderName.contentType, ['text/plain'])
  ..add(HeaderName.custom('x-request-id'), 'abc');

print(headers.value(HeaderName.contentType)); // text/plain

The typed headers, their codecs and the Headers view live in relic_core.

0
likes
160
points
13k
downloads

Documentation

API reference

Publisher

verified publisherserverpod.dev

Weekly Downloads

HTTP header names and stores shared by Relic adapters and other packages.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#server #web #http

License

BSD-3-Clause (license)

More

Packages that depend on relic_headers