utils/req_utils library

Functions

detectEncoding(Uint8List bytes) → String
getRequestHost(H4Event event) → String?
Get incoming request host
getRequestIp(H4Event event) → String?
getRequestProtocol(H4Event event) → String?
Get the request protocol
getRequestUrl(H4Event event) → String?
Get the entire incoming URL.
getRouteParam(H4Event event, {required String name}) → String?
Gets a route parameter value by name from the event.
handleCors(H4Event event, {String origin = "*", String methods = "GET, POST, PUT, DELETE, OPTIONS, HEAD, PATCH", String headers = "Content-Type, Authorization, X-Requested-With", bool credentials = false, int maxAge = 86400}) → void
Handles Cross-Origin Resource Sharing (CORS) headers for HTTP requests.
handleMultipartFormdata(HttpRequest request, String boundary, FormData formData) → Future<FormData>
readFiles(H4Event event, {required String fieldName, String? customFilePath, bool hashFileName = false, int maxFileSize = 10}) → Future<List<Map<String, dynamic>>?>
Reads file(s) from a multipart/form-data request for a specific field name.
readFormData(dynamic event) → Future<FormData>