aboutsummaryrefslogtreecommitdiff
path: root/SocketHttpListener/Net/HttpListenerResponse.cs
diff options
context:
space:
mode:
Diffstat (limited to 'SocketHttpListener/Net/HttpListenerResponse.cs')
-rw-r--r--SocketHttpListener/Net/HttpListenerResponse.cs38
1 files changed, 14 insertions, 24 deletions
diff --git a/SocketHttpListener/Net/HttpListenerResponse.cs b/SocketHttpListener/Net/HttpListenerResponse.cs
index 1cbd6165e..a32aca043 100644
--- a/SocketHttpListener/Net/HttpListenerResponse.cs
+++ b/SocketHttpListener/Net/HttpListenerResponse.cs
@@ -1,14 +1,7 @@
-using System;
-using System.Collections.Generic;
+using System;
using System.IO;
using System.Net;
using System.Text;
-using System.Threading.Tasks;
-using System.Globalization;
-using System.Runtime.InteropServices;
-using System.ComponentModel;
-using System.Diagnostics;
-using Microsoft.Win32.SafeHandles;
namespace SocketHttpListener.Net
{
@@ -22,16 +15,13 @@ namespace SocketHttpListener.Net
private string _statusDescription;
private WebHeaderCollection _webHeaders = new WebHeaderCollection();
- public WebHeaderCollection Headers
- {
- get { return _webHeaders; }
- }
+ public WebHeaderCollection Headers => _webHeaders;
public Encoding ContentEncoding { get; set; }
public string ContentType
{
- get { return Headers["Content-Type"]; }
+ get => Headers["Content-Type"];
set
{
CheckDisposed();
@@ -46,13 +36,13 @@ namespace SocketHttpListener.Net
}
}
- private HttpListenerContext HttpListenerContext { get { return _httpContext; } }
+ private HttpListenerContext HttpListenerContext => _httpContext;
- private HttpListenerRequest HttpListenerRequest { get { return HttpListenerContext.Request; } }
+ private HttpListenerRequest HttpListenerRequest => HttpListenerContext.Request;
internal EntitySendFormat EntitySendFormat
{
- get { return (EntitySendFormat)_boundaryType; }
+ get => (EntitySendFormat)_boundaryType;
set
{
CheckDisposed();
@@ -71,8 +61,8 @@ namespace SocketHttpListener.Net
public bool SendChunked
{
- get { return EntitySendFormat == EntitySendFormat.Chunked; ; }
- set { EntitySendFormat = value ? EntitySendFormat.Chunked : EntitySendFormat.ContentLength; }
+ get => EntitySendFormat == EntitySendFormat.Chunked;
+ set => EntitySendFormat = value ? EntitySendFormat.Chunked : EntitySendFormat.ContentLength;
}
// We MUST NOT send message-body when we send responses with these Status codes
@@ -92,7 +82,7 @@ namespace SocketHttpListener.Net
public long ContentLength64
{
- get { return _contentLength; }
+ get => _contentLength;
set
{
CheckDisposed();
@@ -104,20 +94,20 @@ namespace SocketHttpListener.Net
}
else
{
- throw new ArgumentOutOfRangeException("net_clsmall");
+ throw new ArgumentOutOfRangeException(nameof(value));
}
}
}
public CookieCollection Cookies
{
- get { return _cookies ?? (_cookies = new CookieCollection()); }
- set { _cookies = value; }
+ get => _cookies ?? (_cookies = new CookieCollection());
+ set => _cookies = value;
}
public bool KeepAlive
{
- get { return _keepAlive; }
+ get => _keepAlive;
set
{
CheckDisposed();
@@ -137,7 +127,7 @@ namespace SocketHttpListener.Net
public string RedirectLocation
{
- get { return Headers["Location"]; }
+ get => Headers["Location"];
set
{
// note that this doesn't set the status code to a redirect one