@@ -29,12 +29,11 @@ class Polaris {
29
29
$Polaris.Listener.BeginGetContext ($Polaris.ContextHandler , $Polaris )
30
30
31
31
[System.Net.HttpListenerRequest ]$RawRequest = $Context.Request
32
- [System.Net.HttpListenerResponse ]$RawResponse = $Context.Response
33
32
34
33
$Polaris.Log (" request came in: " + $RawRequest.HttpMethod + " " + $RawRequest.RawUrl )
35
34
36
35
[PolarisRequest ]$Request = [PolarisRequest ]::new($RawRequest )
37
- [PolarisResponse ]$Response = [PolarisResponse ]::new()
36
+ [PolarisResponse ]$Response = [PolarisResponse ]::new($Context .Response )
38
37
39
38
40
39
[string ]$Route = $RawRequest.Url.AbsolutePath
@@ -118,15 +117,15 @@ class Polaris {
118
117
$Response.ByteResponse.CopyTo ($Bytes , $LogBytes.Length )
119
118
$Response.ByteResponse = $Bytes
120
119
}
121
- [Polaris ]::Send($RawResponse , $ Response )
120
+ [Polaris ]::Send($Response )
122
121
123
122
}
124
123
catch {
125
124
$Polaris.Log (($_ | Out-String ))
126
125
$Response.SetStatusCode (500 )
127
126
$Response.Send ($_ )
128
127
try {
129
- [Polaris ]::Send($RawResponse , $ Response )
128
+ [Polaris ]::Send($Response )
130
129
} catch {
131
130
$Polaris.Log ($_ )
132
131
}
@@ -305,12 +304,11 @@ class Polaris {
305
304
}
306
305
307
306
static [void ] Send (
308
- [System.Net.HttpListenerResponse ]$RawResponse ,
309
307
[PolarisResponse ]$Response
310
308
) {
311
309
if ($Response.StreamResponse ) {
312
310
[Polaris ]::Send(
313
- $RawResponse ,
311
+ $Response . RawResponse ,
314
312
$Response.StreamResponse ,
315
313
$Response.StatusCode ,
316
314
$Response.ContentType ,
@@ -319,7 +317,7 @@ class Polaris {
319
317
}
320
318
else {
321
319
[Polaris ]::Send(
322
- $RawResponse ,
320
+ $Response . RawResponse ,
323
321
$Response.ByteResponse ,
324
322
$Response.StatusCode ,
325
323
$Response.ContentType ,
0 commit comments