http library

HTTP kernel with middleware support

Classes

CsrfMiddleware
CSRF Protection Middleware using Double Submit Cookie pattern
HttpKernel
HTTP Kernel for handling HTTP requests

Functions

corsMiddleware({List<String>? allowedOrigins, List<String> allowedMethods = const ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'], List<String> allowedHeaders = const ['Origin', 'Content-Type', 'Accept', 'Authorization', 'X-CSRF-Token'], List<String> exposedHeaders = const [], bool allowCredentials = true, int maxAge = 86400}) → Middleware
CORS Middleware for handling Cross-Origin Resource Sharing
htmlResponse(String content, {int status = 200}) → Response
Create an HTML response
i18nMiddleware({String defaultLocale = 'en'}) → Middleware
Middleware for internationalization
jsonResponse(Map<String, dynamic> data, {int status = 200}) → Response
Create a JSON response
notFound([String? message]) → Response
Create a 404 Not Found response
serverError([String? message]) → Response
Create a 500 Internal Server Error response
textResponse(String content, {int status = 200}) → Response
Create a plain text response