@@ -11,7 +11,8 @@ class SynchronousTransport : Sentry.Http.HttpTransportBase, Sentry.Extensibility
11
11
SynchronousTransport([Sentry.SentryOptions ] $options ) : base($options )
12
12
{
13
13
$this.logger = $options.DiagnosticLogger
14
- if ($null -eq $this.logger ) {
14
+ if ($null -eq $this.logger )
15
+ {
15
16
$this.logger = Get-Variable - Scope script - Name SentryPowerShellDiagnosticLogger - ValueOnly - ErrorAction SilentlyContinue
16
17
}
17
18
@@ -42,16 +43,13 @@ class SynchronousTransport : Sentry.Http.HttpTransportBase, Sentry.Extensibility
42
43
$this.SerializeToStream.Invoke ($request.Content , @ ($memoryStream , $null , $cancellationToken ))
43
44
$memoryStream.Position = 0
44
45
45
- $reader = New-Object System.IO.StreamReader($memoryStream )
46
- $content = $reader.ReadToEnd ()
47
- $reader.Close ()
48
-
49
- if ($null -ne $this.logger ) {
50
- $this.logger.Log ([Sentry.SentryLevel ]::Debug, ' Sending content synchronously, Content-Length: {0}' , $null , $content.Length )
46
+ if ($null -ne $this.logger )
47
+ {
48
+ $this.logger.Log ([Sentry.SentryLevel ]::Debug, ' Sending content synchronously, Content-Length: {0}' , $null , $memoryStream.Length )
51
49
}
52
50
53
51
$ProgressPreference = ' SilentlyContinue'
54
- $psResponse = Invoke-WebRequest - Uri $request.RequestUri - Method $request.Method.Method - Headers $headers - Body $content - UseBasicParsing
52
+ $psResponse = Invoke-WebRequest - Uri $request.RequestUri - Method $request.Method.Method - Headers $headers - Body $memoryStream - UseBasicParsing
55
53
56
54
$response = [System.Net.Http.HttpResponseMessage ]::new($psResponse.StatusCode )
57
55
$contentType = $psResponse.Headers [' Content-Type' ]
0 commit comments