Skip to content

Commit 3397f8e

Browse files
author
Matt Brooks
committed
Deprecating CaptureErrorPostData
1 parent 3b81e44 commit 3397f8e

File tree

3 files changed

+4
-27
lines changed

3 files changed

+4
-27
lines changed

Src/StackifyLib.AspNetCore/WebRequestDetailMapper.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.IO;
34
using System.Linq;
5+
using System.Text;
46
using Microsoft.AspNetCore.Http;
57
using Microsoft.AspNetCore.Routing;
68
using Microsoft.Extensions.DependencyInjection;
@@ -30,7 +32,7 @@ internal static void WebRequestDetail_SetWebRequestDetail(WebRequestDetail detai
3032

3133
private static void Load(HttpContext context, WebRequestDetail detail)
3234
{
33-
if (context == null || context.Request == null)
35+
if (context?.Request == null)
3436
{
3537
return;
3638
}
@@ -58,7 +60,7 @@ private static void Load(HttpContext context, WebRequestDetail detail)
5860

5961
try
6062
{
61-
if (request.QueryString != null)
63+
if (request.QueryString.HasValue)
6264
{
6365
detail.QueryString = ToKeyValues(request.Query, null, null);
6466
}
@@ -87,11 +89,6 @@ private static void Load(HttpContext context, WebRequestDetail detail)
8789
{
8890
detail.Cookies = ToKeyValues(request.Cookies, Config.ErrorCookiesGoodKeys, Config.ErrorCookiesBadKeys);
8991
}
90-
91-
if (request.Form != null && Config.CaptureErrorPostdata)
92-
{
93-
detail.PostData = ToKeyValues(request.Form, null, null);
94-
}
9592
}
9693
catch (Exception)
9794
{

Src/StackifyLib/Config.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ public static void LoadSettings()
3131
{
3232
try
3333
{
34-
CaptureErrorPostdata = Get("Stackify.CaptureErrorPostdata", bool.FalseString).Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase);
35-
3634
CaptureServerVariables = Get("Stackify.CaptureServerVariables", bool.FalseString).Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase);
3735

3836
CaptureSessionVariables = Get("Stackify.CaptureSessionVariables", bool.FalseString).Equals(bool.TrueString, StringComparison.CurrentCultureIgnoreCase);

Src/StackifyLib/Models/WebRequestDetail.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -209,24 +209,6 @@ public void Load(HttpContextBase context)
209209
{
210210
SessionData = ToKeyValues(context.Session, Config.ErrorSessionGoodKeys, null);
211211
}
212-
213-
if (Config.CaptureErrorPostdata)
214-
{
215-
var contentType = context.Request.Headers["Content-Type"];
216-
217-
if (contentType != "text/html" && contentType != "application/x-www-form-urlencoded" &&
218-
context.Request.RequestType != "GET")
219-
{
220-
int length = 4096;
221-
string postBody = new StreamReader(context.Request.InputStream).ReadToEnd();
222-
if (postBody.Length < length)
223-
{
224-
length = postBody.Length;
225-
}
226-
227-
PostDataRaw = postBody.Substring(0, length);
228-
}
229-
}
230212
}
231213
catch
232214
{

0 commit comments

Comments
 (0)