Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Drop support for PowerShell 7.2 and 7.3 ([#71](https://github.com/getsentry/sentry-powershell/pull/71))

### Fixes

- Attachments support regression introduced in v0.2.0 ([#80](https://github.com/getsentry/sentry-powershell/pull/80))

### Features

- Add support for PowerShell 7.5 ([#76](https://github.com/getsentry/sentry-powershell/pull/76))
Expand Down
14 changes: 6 additions & 8 deletions modules/Sentry/private/SynchronousTransport.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class SynchronousTransport : Sentry.Http.HttpTransportBase, Sentry.Extensibility
SynchronousTransport([Sentry.SentryOptions] $options) : base($options)
{
$this.logger = $options.DiagnosticLogger
if ($null -eq $this.logger) {
if ($null -eq $this.logger)
{
$this.logger = Get-Variable -Scope script -Name SentryPowerShellDiagnosticLogger -ValueOnly -ErrorAction SilentlyContinue
}

Expand Down Expand Up @@ -42,16 +43,13 @@ class SynchronousTransport : Sentry.Http.HttpTransportBase, Sentry.Extensibility
$this.SerializeToStream.Invoke($request.Content, @($memoryStream, $null, $cancellationToken))
$memoryStream.Position = 0

$reader = New-Object System.IO.StreamReader($memoryStream)
$content = $reader.ReadToEnd()
$reader.Close()

if ($null -ne $this.logger) {
$this.logger.Log([Sentry.SentryLevel]::Debug, 'Sending content synchronously, Content-Length: {0}', $null, $content.Length)
if ($null -ne $this.logger)
{
$this.logger.Log([Sentry.SentryLevel]::Debug, 'Sending content synchronously, Content-Length: {0}', $null, $memoryStream.Length)
}

$ProgressPreference = 'SilentlyContinue'
$psResponse = Invoke-WebRequest -Uri $request.RequestUri -Method $request.Method.Method -Headers $headers -Body $content -UseBasicParsing
$psResponse = Invoke-WebRequest -Uri $request.RequestUri -Method $request.Method.Method -Headers $headers -Body $memoryStream -UseBasicParsing

$response = [System.Net.Http.HttpResponseMessage]::new($psResponse.StatusCode)
$contentType = $psResponse.Headers['Content-Type']
Expand Down
Loading