-
Notifications
You must be signed in to change notification settings - Fork 309
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
Echo Funlet #18
Comments
Annotated Source Codebased on a snapshot of Echo TwiML source code (echo.php) This is PHP code.
It is shared by Twilio under the MIT license.
Send Content-Type header for an XML document (TwiML is XML).
Send the contents of the
(there is no check that we received valid TwiML at this point, invalid TwiML will fail further in the flow) |
Test Case[Echo-1] Successful EchoInput
Output
|
ImplementationI created a first version of the Echo Funlet. I started by developing it online by creating a new Twilio Function in my Twilio account:
This implementation works but does not set the
I found in the documentation how to construct a response with custom headers, using an instance of
This works and returns the expected Content Type:
But when trying to do the same, including unit tests, in the environment of this project, I managed to define the first implementation, but the second one, using
@dkundel is there something that I should be aware of? |
I don’t think this is something I implemented for the custom test harness, which you can see here: https://github.com/twilio-labs/function-templates/blob/master/test/test-helper.js. Will have to look into this for the more complicated responses like this (ironic for such a simple twimlet!). You can probably set the tests as pending for now if you want to carry on with implementation. |
Yeah this seems to be a test issue. I think we should be using some parts of twilio-run for the tests actually @philnash. I was thinking about that the other day but haven't had time to work on it. I'll file an issue for this. But yeah for your case you'd be fine with your implementation and set the testing to pending for now. The only nitpick is that the default should be |
I'll do that. Thanks. |
Unit Tests
OK for now: the skipped test is |
Integration TestsAfter deploying the funlet to my Twilio account, with the
The comparison is not actually done in the script, but can be done as a second step, in case of doubt:
|
Ooooooh I love that 😊 |
@philnash I was not using the test helper. I have added it to the unit tests for the Echo Funlet, and with minimal modifications of my tests, it works fine for my purpose. In retrospect, my confusion stems from the fact that I expected the Is there a GitHub project where I can find the definition of this special |
The |
Thanks! I see the light 💡! |
Migrate the Echo Twimlet to an equivalent Twilio Function Template.
Stage 1
Respond with the contents of the
Twiml
parameter.The text was updated successfully, but these errors were encountered: