8000 Add Formatting Options to TwiML methods and classes + refactor by Swimburger · Pull Request #95 · twilio-labs/twilio-aspnet · GitHub
[go: up one dir, main page]

Skip to content

Add Formatting Options to TwiML methods and classes + refactor #95

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 ou 8000 r terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 15, 2022

Conversation

Swimburger
Copy link
Contributor

I added overloads for TwiML methods and TwiML Result classes to accept the formatting options of the XML.
This way, a user can choose to remove the formatting and respond with smaller XML payloads. (implements #89)

I did a larger refactor of the TwiMLResult class for MVC. This refactoring does the following:

  • Write TwiML directly to response output instead of creating an XDocument of it first.
  • Write incoming string directly to response output instead of creating an XDocument of it first. The XDocument would've automatically used the correct encoding that is used by the response output. In this case, I'm assuming the user knows what the correct encoding is and has created the XML string correctly to match the output encoding.
  • No need to specify Encoding anymore as the code that needed it no longer exists.

Personally, I think we can lose the XDocument and string constructors for TwiMLResult to simplify the class.

Ascii and Unicode still work as expected as I still receive those characters via SMS. I added tests to verify that the TwiML is written to the output correctly, respecting the output encoding.

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 October 5, 2022 15:41
@Swimburger Swimburger changed the base branch from main to releases/v7 October 5, 2022 15:42
@Swimburger Swimburger changed the base branch from releases/v7 to main October 5, 2022 15:44
@Swimburger Swimburger changed the base branch from main to releases/v7 October 5, 2022 15:44
Copy link
Collaborator
@dprothero dprothero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Swimburger Swimburger merged commit f0de423 into releases/v7 Nov 15, 2022
@Swimburger Swimburger deleted the twimlresult-refactor branch November 15, 2022 21:08
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
0