|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
import type { ConnectionManager, IConnection } from './connection'
|
|
|
|
import { IMessage, MessageType } from './message'
|
|
|
|
import { IMessage, MessageType } from './message'
|
|
|
|
import { arrayBufferToBase64, bufHexView, getSize, isTextBody } from './utils'
|
|
|
|
import { arrayBufferToBase64, bufHexView, getSize, isTextBody } from './utils'
|
|
|
|
|
|
|
|
|
|
|
@ -73,7 +74,10 @@ export class Flow {
|
|
|
|
private _previewRequestBody: IPreviewBody | null = null
|
|
|
|
private _previewRequestBody: IPreviewBody | null = null
|
|
|
|
private _hexviewResponseBody: string | null = null
|
|
|
|
private _hexviewResponseBody: string | null = null
|
|
|
|
|
|
|
|
|
|
|
|
constructor(msg: IMessage) {
|
|
|
|
private connMgr: ConnectionManager;
|
|
|
|
|
|
|
|
private conn: IConnection | undefined;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor(msg: IMessage, connMgr: ConnectionManager) {
|
|
|
|
this.no = ++Flow.curNo
|
|
|
|
this.no = ++Flow.curNo
|
|
|
|
this.id = msg.id
|
|
|
|
this.id = msg.id
|
|
|
|
this.waitIntercept = msg.waitIntercept
|
|
|
|
this.waitIntercept = msg.waitIntercept
|
|
|
@ -89,6 +93,8 @@ export class Flow {
|
|
|
|
this._isTextResponse = null
|
|
|
|
this._isTextResponse = null
|
|
|
|
this._requestBody = null
|
|
|
|
this._requestBody = null
|
|
|
|
this._responseBody = null
|
|
|
|
this._responseBody = null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.connMgr = connMgr
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public addRequestBody(msg: IMessage): Flow {
|
|
|
|
public addRequestBody(msg: IMessage): Flow {
|
|
|
@ -248,6 +254,12 @@ export class Flow {
|
|
|
|
this._hexviewResponseBody = bufHexView(this.response.body)
|
|
|
|
this._hexviewResponseBody = bufHexView(this.response.body)
|
|
|
|
return this._hexviewResponseBody
|
|
|
|
return this._hexviewResponseBody
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public getConn(): IConnection | undefined {
|
|
|
|
|
|
|
|
if (this.conn) return this.conn
|
|
|
|
|
|
|
|
this.conn = this.connMgr.get(this.connId)
|
|
|
|
|
|
|
|
return this.conn
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export class FlowManager {
|
|
|
|
export class FlowManager {
|
|
|
|