Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Titanium-Web-Proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Titanium-Web-Proxy
Commits
ca08a33d
Unverified
Commit
ca08a33d
authored
May 06, 2018
by
justcoding121
Committed by
GitHub
May 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update example without RequestId
parent
081d1b8c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
README.md
README.md
+8
-7
No files found.
README.md
View file @
ca08a33d
...
...
@@ -122,8 +122,8 @@ Sample request and response event handlers
```
csharp
//To access requestBody from OnResponse handler
private
IDictionary
<
Guid
,
string
>
requestBody
History
=
new
ConcurrentDictionary
<
Guid
,
string
>();
private
HashSet
<
SessionEventArgs
>
request
History
=
new
HashSet
<
SessionEventArgs
>();
private
async
Task
OnBeforeTunnelConnectRequest
(
object
sender
,
TunnelConnectSessionEventArgs
e
)
{
...
...
@@ -156,9 +156,10 @@ public async Task OnRequest(object sender, SessionEventArgs e)
string
bodyString
=
await
e
.
GetRequestBodyAsString
();
await
e
.
SetRequestBodyString
(
bodyString
);
//store request
Body/request headers etc with request Id as key
//store request
//so that you can find it from response handler using request Id
requestBodyHistory
[
e
.
Id
]
=
bodyString
;
//You can also use e.UserData to set any user data and access it from response
requestHistory
.
Add
(
e
);
}
//To cancel a request with a custom HTML content
...
...
@@ -202,10 +203,10 @@ public async Task OnResponse(object sender, SessionEventArgs e)
}
}
//access request b
ody/request headers etc by looking up using requestId
if
(
request
BodyHistory
.
ContainsKey
(
e
.
Id
))
//access request b
y looking up HashSet
if
(
request
History
.
ContainsKey
(
e
))
{
var
request
Body
=
requestBodyHistory
[
e
.
Id
];
var
request
=
requestHistory
[
e
];
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment