mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 10:49:49 +08:00
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:
@@ -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) =>
|
||||
|
||||
Reference in New Issue
Block a user