in src/Utility/Utils.cs [191:218]
internal static object TransformOutBindingValueAsNeeded(string bindingName, ReadOnlyBindingInfo bindingInfo, object value)
{
switch (bindingInfo.Type)
{
case "http":
// Try converting the value to HttpResponseContext if it's not already an object of such type.
if (value is HttpResponseContext)
{
break;
}
try
{
value = LanguagePrimitives.ConvertTo<HttpResponseContext>(value);
}
catch (PSInvalidCastException ex)
{
string errorMsg = string.Format(PowerShellWorkerStrings.FailToConvertToHttpResponseContext, bindingName, ex.Message);
throw new InvalidOperationException(errorMsg);
}
break;
default:
break;
}
return value;
}