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
db9e05d0
Commit
db9e05d0
authored
Nov 04, 2016
by
Jehonathan
Committed by
GitHub
Nov 04, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #145 from nordinrahman/patchMethodSupport
Add support for request with PATCH method
parents
b66fe657
545f5b66
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
9 deletions
+13
-9
ProxyTestController.cs
.../Titanium.Web.Proxy.Examples.Basic/ProxyTestController.cs
+2
-1
README.md
README.md
+3
-2
SessionEventArgs.cs
Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
+4
-3
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+4
-3
No files found.
Examples/Titanium.Web.Proxy.Examples.Basic/ProxyTestController.cs
View file @
db9e05d0
...
...
@@ -79,7 +79,8 @@ namespace Titanium.Web.Proxy.Examples.Basic
////read request headers
var
requestHeaders
=
e
.
WebSession
.
Request
.
RequestHeaders
;
if
((
e
.
WebSession
.
Request
.
Method
==
"POST"
||
e
.
WebSession
.
Request
.
Method
==
"PUT"
))
var
method
=
e
.
WebSession
.
Request
.
Method
.
ToUpper
();
if
((
method
==
"POST"
||
method
==
"PUT"
||
method
==
"PATCH"
))
{
//Get/Set request body bytes
byte
[]
bodyBytes
=
await
e
.
GetRequestBody
();
...
...
README.md
View file @
db9e05d0
...
...
@@ -107,8 +107,9 @@ Sample request and response event handlers
////read request headers
var
requestHeaders
=
e
.
WebSession
.
Request
.
RequestHeaders
;
if
((
e
.
WebSession
.
Request
.
Method
==
"POST"
||
e
.
WebSession
.
Request
.
Method
==
"PUT"
))
var
method
=
e
.
WebSession
.
Request
.
Method
.
ToUpper
();
if
((
method
==
"POST"
||
method
==
"PUT"
||
method
==
"PATCH"
))
{
//Get/Set request body bytes
byte
[]
bodyBytes
=
await
e
.
GetRequestBody
();
...
...
Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
View file @
db9e05d0
...
...
@@ -81,10 +81,11 @@ namespace Titanium.Web.Proxy.EventArguments
private
async
Task
ReadRequestBody
()
{
//GET request don't have a request body to read
if
((
WebSession
.
Request
.
Method
.
ToUpper
()
!=
"POST"
&&
WebSession
.
Request
.
Method
.
ToUpper
()
!=
"PUT"
))
var
method
=
WebSession
.
Request
.
Method
.
ToUpper
();
if
((
method
!=
"POST"
&&
method
!=
"PUT"
&&
method
!=
"PATCH"
))
{
throw
new
BodyNotFoundException
(
"Request don't have a body."
+
"Please verify that this request is a Http POST/PUT and request "
+
throw
new
BodyNotFoundException
(
"Request don't have a body.
"
+
"Please verify that this request is a Http POST/PUT
/PATCH
and request "
+
"content length is greater than zero before accessing the body."
);
}
...
...
Titanium.Web.Proxy/RequestHandler.cs
View file @
db9e05d0
...
...
@@ -312,8 +312,9 @@ namespace Titanium.Web.Proxy
{
if
(!
args
.
WebSession
.
Request
.
ExpectationFailed
)
{
//If its a post/put request, then read the client html body and send it to server
if
(
args
.
WebSession
.
Request
.
Method
.
ToUpper
()
==
"POST"
||
args
.
WebSession
.
Request
.
Method
.
ToUpper
()
==
"PUT"
)
//If its a post/put/patch request, then read the client html body and send it to server
var
method
=
args
.
WebSession
.
Request
.
Method
.
ToUpper
();
if
(
method
==
"POST"
||
method
==
"PUT"
||
method
==
"PATCH"
)
{
await
SendClientRequestBody
(
args
);
}
...
...
@@ -570,7 +571,7 @@ namespace Titanium.Web.Proxy
}
/// <summary>
/// This is called when the request is PUT/POST to read the body
/// This is called when the request is PUT/POST
/PATCH
to read the body
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
...
...
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