forked from cefsharp/CefSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequestResponse.cpp
More file actions
42 lines (35 loc) · 1.06 KB
/
RequestResponse.cpp
File metadata and controls
42 lines (35 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "Stdafx.h"
#include "RequestResponse.h"
namespace CefSharp
{
void RequestResponse::Cancel()
{
_action = ResponseAction::Cancel;
}
void RequestResponse::Redirect(String^ url)
{
_redirectUrl = url;
_action = ResponseAction::Redirect;
}
void RequestResponse::RespondWith(Stream^ stream, String^ mimeType)
{
RespondWith(stream, mimeType, "OK", 200, nullptr);
}
void RequestResponse::RespondWith(Stream^ stream, String^ mimeType, String^ statusText, int statusCode, IDictionary<String^, String^>^ responseHeaders)
{
if (String::IsNullOrEmpty(mimeType))
{
throw gcnew ArgumentException("must provide a mime type", "mimeType");
}
if (stream == nullptr)
{
throw gcnew ArgumentNullException("stream");
}
_responseStream = stream;
_mimeType = mimeType;
_statusText = statusText;
_statusCode = statusCode;
_responseHeaders = responseHeaders;
_action = ResponseAction::Respond;
}
}