Skip to content

Commit

Permalink
fix(*): 🐛 Fixed TwiML Response error
Browse files Browse the repository at this point in the history
TwiMLResponse was throwin a 500 error when the body was not of type string.
  • Loading branch information
iagocalazans committed Jun 17, 2022
1 parent a6b6681 commit 5f750a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/responses/twiml.response.js
Expand Up @@ -14,8 +14,8 @@ exports.TwiMLResponse = class TwiMLResponse extends Twilio.Response {
const stringBody = body.toString();

if (!stringBody.includes('<?xml version="1.0" encoding="UTF-8"?>')) {
this.setBody('<?xml version="1.0" encoding="UTF-8"?><InvalidTwiMLResponse />');
this.setStatusCode(400);
this.setBody('<?xml version="1.0" encoding="UTF-8"?><Response />');
this.setStatusCode(200);
return this;
}

Expand Down

0 comments on commit 5f750a0

Please sign in to comment.