-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
.NETIssue or Pull requests regarding .NET codeIssue or Pull requests regarding .NET codebugSomething isn't workingSomething isn't working
Description
Describe the bug
If the Content-Type header of a REST API JSON response includes a charset (e.g. Content-Type: application/json; charset=utf-8), the Handlebars prompt template handles the response as a string instead of as deserialized JSON.
To Reproduce
The issue appears to be due to how the Content-Type is matched here:
Lines 211 to 221 in fe29d1a
| if (resultAsObject is RestApiOperationResponse restApiOperationResponse) | |
| { | |
| // Deserialize any JSON content or return the content as a string | |
| if (string.Equals(restApiOperationResponse.ContentType, "application/json", StringComparison.OrdinalIgnoreCase)) | |
| { | |
| var parsedJson = JsonValue.Parse(restApiOperationResponse.Content.ToString()); | |
| return KernelHelpersUtils.DeserializeJsonNode(parsedJson); | |
| } | |
| return restApiOperationResponse.Content; | |
| } |
Expected behavior
The JSON response should be deserialized.
Platform
- Language: C#
- Source:
Microsoft.SemanticKernel.PromptTemplates.Handlebarsversion1.4.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
.NETIssue or Pull requests regarding .NET codeIssue or Pull requests regarding .NET codebugSomething isn't workingSomething isn't working
Type
Projects
Status
Sprint: Done