Remove FormObject.cs and FormObjectCollection.cs (#19383)

This commit is contained in:
CarloToso authored and GitHub committed 2023-03-21 22:59:14 +05:00
1 parent 5b1dedac61
commit 190c99a416
3 files changed
-95

No files matched your search

@@ -1157,9 +1157,6 @@ namespace Microsoft.PowerShell.Commands
switch (content)
{
case FormObject form:
SetRequestContent(request, form.Fields);
break;
case IDictionary dictionary when request.Method != HttpMethod.Get:
SetRequestContent(request, dictionary);
break;
@@ -1,55 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System.Collections.Generic;
namespace Microsoft.PowerShell.Commands
{
/// <summary>
/// FormObject used in HtmlWebResponseObject.
/// </summary>
public class FormObject
{
/// <summary>
/// Gets the Id property.
/// </summary>
public string Id { get; }
/// <summary>
/// Gets the Method property.
/// </summary>
public string Method { get; }
/// <summary>
/// Gets the Action property.
/// </summary>
public string Action { get; }
/// <summary>
/// Gets the Fields property.
/// </summary>
public Dictionary<string, string> Fields { get; }
/// <summary>
/// Initializes a new instance of the <see cref="FormObject"/> class.
/// </summary>
/// <param name="id"></param>
/// <param name="method"></param>
/// <param name="action"></param>
public FormObject(string id, string method, string action)
{
Id = id;
Method = method;
Action = action;
Fields = new Dictionary<string, string>();
}
internal void AddField(string key, string value)
{
if (key is not null && !Fields.TryGetValue(key, out string test))
{
Fields[key] = value;
}
}
}
}
@@ -1,37 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.Collections.ObjectModel;
namespace Microsoft.PowerShell.Commands
{
/// <summary>
/// FormObjectCollection used in HtmlWebResponseObject.
/// </summary>
public class FormObjectCollection : Collection<FormObject>
{
/// <summary>
/// Gets the FormObject from the key.
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public FormObject this[string key]
{
get
{
FormObject form = null;
foreach (FormObject f in this)
{
if (string.Equals(key, f.Id, StringComparison.OrdinalIgnoreCase))
{
form = f;
break;
}
}
return form;
}
}
}
}