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
d1dd9545
Commit
d1dd9545
authored
Dec 09, 2016
by
kevinrmcd
Committed by
GitHub
Dec 09, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update SessionEventArgs.cs
Adding ability to easily create non-200 or non-302 responses.
parent
6bdec0f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
1 deletion
+40
-1
SessionEventArgs.cs
Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
+40
-1
No files found.
Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
View file @
d1dd9545
...
@@ -417,6 +417,45 @@ namespace Titanium.Web.Proxy.EventArguments
...
@@ -417,6 +417,45 @@ namespace Titanium.Web.Proxy.EventArguments
WebSession
.
Request
.
CancelRequest
=
true
;
WebSession
.
Request
.
CancelRequest
=
true
;
}
}
public
async
Task
GenericResponse
(
string
html
,
HttpStatusCode
status
)
{
await
GenericResponse
(
html
,
null
,
status
);
}
public
async
Task
GenericResponse
(
string
html
,
Dictionary
<
string
,
HttpHeader
>
headers
,
HttpStatusCode
status
)
{
if
(
WebSession
.
Request
.
RequestLocked
)
{
throw
new
Exception
(
"You cannot call this function after request is made to server."
);
}
if
(
html
==
null
)
{
html
=
string
.
Empty
;
}
var
result
=
Encoding
.
Default
.
GetBytes
(
html
);
await
GenericResponse
(
result
,
headers
,
status
);
}
public
async
Task
GenericResponse
(
byte
[]
result
,
Dictionary
<
string
,
HttpHeader
>
headers
,
HttpStatusCode
status
)
{
var
response
=
new
GenericResponse
(
status
);
if
(
headers
!=
null
&&
headers
.
Count
>
0
)
{
response
.
ResponseHeaders
=
headers
;
}
response
.
HttpVersion
=
WebSession
.
Request
.
HttpVersion
;
response
.
ResponseBody
=
result
;
await
Respond
(
response
);
WebSession
.
Request
.
CancelRequest
=
true
;
}
public
async
Task
Redirect
(
string
url
)
public
async
Task
Redirect
(
string
url
)
{
{
...
@@ -452,4 +491,4 @@ namespace Titanium.Web.Proxy.EventArguments
...
@@ -452,4 +491,4 @@ namespace Titanium.Web.Proxy.EventArguments
}
}
}
}
}
}
\ No newline at end of file
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