Adrià Vilanova MartÃnez | 9c418ab | 2024-12-05 15:34:40 +0100 | [diff] [blame] | 1 | import { ProtobufObject } from "../common/protojs.types"; |
| 2 | |
| 3 | export interface ResponseModifierPort { |
| 4 | intercept(interception: InterceptedResponse): Promise<Result>; |
| 5 | } |
| 6 | |
| 7 | /** |
| 8 | * Represents an intercepted response. |
| 9 | */ |
| 10 | export interface InterceptedResponse { |
| 11 | /** |
| 12 | * URL of the original request. |
| 13 | */ |
| 14 | url: string; |
| 15 | |
| 16 | /** |
| 17 | * Object with the response as intercepted without any modification. |
| 18 | */ |
| 19 | originalResponse: ProtobufObject; |
| 20 | } |
| 21 | |
| 22 | export type Result = |
| 23 | | { wasModified: false } |
| 24 | | { |
| 25 | wasModified: true; |
| 26 | modifiedResponse: ProtobufObject; |
| 27 | }; |