context.headers / context.setHeader()
Access request headers and set response headers.
This API can only be used on the server and is only available using the package:jaspr/server.dart import.
context.headers
With the context.headers and context.headersAll getters you can access the HTTP headers of the currently handled request on the server.
class MyComponent extends StatelessComponent {
  @override
  Component build(BuildContext context) {
    final userAgent = context.headers['user-agent'];
    return p([text('User-Agent: $userAgent')]);
  }
}
context.setHeader()
The context.setHeader(String name, String value) method lets you set a response header for the current request.
class MyComponent extends StatelessComponent {
  @override
  Component build(BuildContext context) {
    context.setHeader('X-Rendered-By', 'Jaspr');
    return p([text('Hello, World!')]);
  }
}

