feat: add support for pre-request scripts

Introduces `preRequestScript` and `postRequestScript` fields to the request model to store user-defined scripts.

Implements a service using `flutter_js` to execute JavaScript pre-request scripts before a request is sent.
The script can access and modify request data (like headers, body, URL) and environment variables.

Adds bridging to forward JavaScript `console.log`, `console.warn`, and `console.error` calls to the Dart console for easier debugging
This commit is contained in:
Udhay-Adithya
2025-04-25 23:26:31 +05:30
parent 839d8b5c00
commit fadf49372f
4 changed files with 220 additions and 18 deletions

View File

@@ -22,6 +22,8 @@ class RequestModel with _$RequestModel {
HttpResponseModel? httpResponseModel,
@JsonKey(includeToJson: false) @Default(false) bool isWorking,
@JsonKey(includeToJson: false) DateTime? sendingTime,
@Default("") String preRequestScript,
@Default("") String postRequestScript,
}) = _RequestModel;
factory RequestModel.fromJson(Map<String, Object?> json) =>