This repository has been archived by the owner on Jul 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#823 Add before write body prototype
- Loading branch information
1 parent
d01da7e
commit 8a32fa9
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
src/Titanium.Web.Proxy/EventArguments/BeforeBodySendEventArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#if DEBUG | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Titanium.Web.Proxy.EventArguments | ||
{ | ||
|
||
public class BeforeBodyWriteEventArgs : ProxyEventArgsBase | ||
{ | ||
internal BeforeBodyWriteEventArgs(SessionEventArgs session, byte[] bodyBytes, bool isChunked, bool isFinalChunk) : base(session.ClientConnection) | ||
{ | ||
Session = session; | ||
BodyBytes = bodyBytes; | ||
IsChunked = isChunked; | ||
IsFinalChunk = isFinalChunk; | ||
} | ||
|
||
|
||
/// <value> | ||
/// The session arguments. | ||
/// </value> | ||
public SessionEventArgs Session { get; } | ||
|
||
/// <summary> | ||
/// Indicates whether body is written chunked stream. | ||
/// If this is true, BeforeRequestBodySend or BeforeResponseBodySend will be called until IsLastChunk is false. | ||
/// </summary> | ||
public bool IsChunked { get; } | ||
|
||
/// <summary> | ||
/// Indicates if this is the last chunk from client or server stream, when request is chunked. | ||
/// Override this property to true if there are more bytes to write. | ||
/// </summary> | ||
public bool IsFinalChunk { get; set; } | ||
|
||
/// <summary> | ||
/// The bytes about to be written. If IsChunked is true, this will be a chunk of the bytes to be written. | ||
/// Override this property with custom bytes if needed, and adjust IsLastChunk accordingly. | ||
/// </summary> | ||
public byte[] BodyBytes { get; set; } | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters