-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is this your first time submitting a feature request?
- I have searched the existing issues, and I could not find an existing issue for this feature
- I am requesting a straightforward extension of existing functionality
Describe the feature
when handling the response body of http requests, we should directly desrialize the body into the class without manually calling ReadAsStringAsync.
we should instead use the T? result = await response.Content.ReadFromJsonAsync<T>(); API as described here https://learn.microsoft.com/en-us/dotnet/fundamentals/networking/http/httpclient#explore-http-valid-content-responses. this only works for JSON content which we are using here.
pinecone-dotnet-client/src/Pinecone/Index/IndexClient.cs
Lines 63 to 69 in fc0dc16
| if (response.StatusCode is >= 200 and < 400) | |
| { | |
| var responseBody = await response.Raw.Content.ReadAsStringAsync(); | |
| try | |
| { | |
| return JsonUtils.Deserialize<ListImportsResponse>(responseBody)!; | |
| } |
Describe alternatives you've considered
No response
Who will this benefit?
performance and allocation
Are you interested in contributing this feature?
No response
Anything else?
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request