File tree 2 files changed +45
-0
lines changed
Types/HttpListener/Request
2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ <#
2
+ . SYNOPSIS
3
+ Gets the request's module
4
+ . DESCRIPTION
5
+ Gets the module that is associated with the request.
6
+
7
+ By default, this will be any module whose `.Server` property matches the request's `.Url.DnsSafeHost` property.
8
+ . NOTES
9
+ This property can also be set directly, in order to serve a different loaded module.
10
+ #>
11
+ if ($this .' .CachedModule' ) { return $this .' .CachedModule' }
12
+
13
+ $loadedModules = @ (Get-Module )
14
+ $ModulesForRequest =
15
+ foreach ($loadedModule in $loadedModules ) {
16
+ if ($loadedModule.Server -and
17
+ $this.Url.DnsSafeHost -in $loadedModule.Server ) {
18
+ $loadedModule
19
+ }
20
+ }
21
+
22
+ $this.psobject.properties.add ((
23
+ [psnoteproperty ]::new(' .CachedModule' , $ModulesForRequest )
24
+ ), $true )
25
+
26
+ return $this .' .CachedModule'
Original file line number Diff line number Diff line change
1
+ <#
2
+ . SYNOPSIS
3
+ Sets the request's module
4
+ . DESCRIPTION
5
+ Sets the module that is associated with the request.
6
+
7
+ By default, this will be any module whose `.Server` property matches the request's `.Url.DnsSafeHost` property.
8
+
9
+ If needed, the module can be set directly, in order to serve a different loaded module.
10
+ #>
11
+ param (
12
+ # The module to associate with the request
13
+ [Parameter (Mandatory )]
14
+ [Management.Automation.PSModuleInfo ]$Module
15
+ )
16
+
17
+ $this.psobject.properties.add ((
18
+ [psnoteproperty ]::new(' .CachedModule' , $Module )
19
+ ), $true )
You can’t perform that action at this time.
0 commit comments