Fall back to well-known URL in client if 401 response is missing resource_metadata parameter (#1054)
This commit is contained in:
parent
d99f882884
commit
970207989e
1 changed files with 497 additions and 134 deletions
|
|
@ -70,8 +70,6 @@ public sealed class ElicitationCapability
|
|||
}
|
||||
|
||||
var capability = new ElicitationCapability();
|
||||
bool hasForm = false;
|
||||
bool hasUrl = false;
|
||||
|
||||
foreach (var property in document.RootElement.EnumerateObject())
|
||||
{
|
||||
|
|
@ -80,19 +78,18 @@ public sealed class ElicitationCapability
|
|||
capability.Form = property.Value.ValueKind == JsonValueKind.Null
|
||||
? null
|
||||
: capability.Form ?? new FormElicitationCapability();
|
||||
hasForm = true;
|
||||
}
|
||||
else if (property.NameEquals("url"))
|
||||
{
|
||||
capability.Url = property.Value.ValueKind == JsonValueKind.Null
|
||||
? null
|
||||
: capability.Url ?? new UrlElicitationCapability();
|
||||
hasUrl = capability.Url is not null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasForm && !hasUrl)
|
||||
if (capability.Form is null && capability.Url is null)
|
||||
{
|
||||
// If both modes are null, default to form mode for backward compatibility.
|
||||
capability.Form = new FormElicitationCapability();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue