Skip to content

Commit 7b74eef

Browse files
authored
fix null reference and method case insensitive for Invoke-AzRestMethod (#13302)
* fix null reference * Update InvokeAzRestMethodCommand.cs * Update ChangeLog.md * Update ChangeLog.md
1 parent c29e0ae commit 7b74eef

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Accounts/Accounts/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Fixed null reference and method case insensitive in `Invoke-AzRestMethod`
2122
* [Breaking Change] Removed `Get-AzProfile` and `Select-AzProfile`
2223
* Updated Azure.Core to 1.5.1
2324

src/Accounts/Accounts/Rest/InvokeAzRestMethodCommand.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public override void ExecuteCmdlet()
108108
this.Path = ConstructPath(this.IsParameterBound(c => c.SubscriptionId) ? this.SubscriptionId : context.Subscription.Id, this.ResourceGroupName, this.ResourceProviderName, this.ResourceType, this.Name);
109109
}
110110

111-
switch (this.Method)
111+
switch (this.Method.ToUpper())
112112
{
113113
case "GET":
114114
response = ServiceClient
@@ -197,7 +197,7 @@ private string ConstructPath(string sub, string rg, string rp, string[] types, s
197197
for (int i = 0; i < types.Length; i++)
198198
{
199199
sb.Append(slash + types[i]);
200-
if (i != names.Length)
200+
if (names != null && i != names.Length)
201201
{
202202
sb.Append(slash + names[i]);
203203
}
@@ -206,4 +206,4 @@ private string ConstructPath(string sub, string rg, string rp, string[] types, s
206206
return sb.ToString();
207207
}
208208
}
209-
}
209+
}

0 commit comments

Comments
 (0)