Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use XDocument.Save or XDocument.SaveAsync to write to response body when possible #112

Closed
wants to merge 5 commits into from

Conversation

Swimburger
Copy link
Contributor

With the new TwiML.ToXDocument() method (PR) from the Twilio C# helper library, we can now avoid serializing the XML to a big string before writing it to the response body.

ASP.NET Core does require writes to the response to be async, and in older .NET Core versions XDocument.SaveAsync is not available. In that case, the XML is serialized to a string and written to the response.

For ASP.NET, there's only XDocument.Save available but there's no need for asynchronous writes.


Additionally, I replaced null checks with string.IsNullOrEmpty for BaseUrlOverride because sometimes the setting is an empty string.

Contributing to Twilio

All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.

  • I acknowledge that all my contributions will be made under the project's license.

@Swimburger Swimburger requested a review from dprothero December 7, 2022 18:39
@Swimburger
Copy link
Contributor Author

Assuming PR twilio-csharp#669 is merged into Twilio helper library for .NET, the new ToString, Save, and SaveAsync would be more performant. Putting this on hold.

@Swimburger Swimburger removed the request for review from dprothero February 8, 2023 17:32
@AJLange AJLange closed this Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants