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
2eab67fa
Commit
2eab67fa
authored
May 08, 2017
by
Jehonathan Thomas
Committed by
GitHub
May 08, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update README.md
parent
cbda4ca6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
README.md
README.md
+14
-1
No files found.
README.md
View file @
2eab67fa
...
@@ -110,6 +110,10 @@ proxyServer.Stop();
...
@@ -110,6 +110,10 @@ proxyServer.Stop();
Sample request and response event handlers
Sample request and response event handlers
```
csharp
```
csharp
//To access requestBody from OnResponse handler
private
Dictionary
<
Guid
,
string
>
requestBodyHistory
;
public
async
Task
OnRequest
(
object
sender
,
SessionEventArgs
e
)
public
async
Task
OnRequest
(
object
sender
,
SessionEventArgs
e
)
{
{
Console
.
WriteLine
(
e
.
WebSession
.
Request
.
Url
);
Console
.
WriteLine
(
e
.
WebSession
.
Request
.
Url
);
...
@@ -127,7 +131,10 @@ public async Task OnRequest(object sender, SessionEventArgs e)
...
@@ -127,7 +131,10 @@ public async Task OnRequest(object sender, SessionEventArgs e)
//Get/Set request body as string
//Get/Set request body as string
string
bodyString
=
await
e
.
GetRequestBodyAsString
();
string
bodyString
=
await
e
.
GetRequestBodyAsString
();
await
e
.
SetRequestBodyString
(
bodyString
);
await
e
.
SetRequestBodyString
(
bodyString
);
//store request Body/request headers etc with request Id as key
//so that you can find it from response handler using request Id
requestBodyHistory
[
e
.
Id
]
=
bodyString
;
}
}
//To cancel a request with a custom HTML content
//To cancel a request with a custom HTML content
...
@@ -170,6 +177,12 @@ public async Task OnResponse(object sender, SessionEventArgs e)
...
@@ -170,6 +177,12 @@ public async Task OnResponse(object sender, SessionEventArgs e)
}
}
}
}
}
}
//access request body/request headers etc by looking up using requestId
if
(
requestBodyHistory
.
ContainsKey
(
e
.
Id
))
{
var
requestBody
=
requestBodyHistory
[
e
.
Id
];
}
}
}
/// Allows overriding default certificate validation logic
/// Allows overriding default certificate validation logic
...
...
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