Is there a way to adjust Twilio "invalid content-type" debug errors?

Viewed 385

In this case, I am using an Express.js server to handle inbound Twilio webhooks and return an http response

However, I am seeing Twilio errors display in the debug console. This is the error Twilio displays in their console:

sourceComponent "14100"
ErrorCode   "12300"
LogLevel    "ERROR"
Msg "Invalid Content-Type: application/json; charset=utf-8 supplied"
contentType "application/json; charset=utf-8"
EmailNotification   "false"

I looked into overriding the Content-Type that is returned, but Express.js overrides this.

We're able to handle the inbound message so this doesn't seem fatal to my application, but should I be more concerned about this? Anything I should be looking into deeper?

I'm also looking into this similar problem (their app uses C#) where the answer seemed to be UTF8 encoding, but not sure if that solves the problem if Express.js overrides anyway

1 Answers

You can use Express to return the appropriate MIME type, as defined here. Reference this repo to see the code.

TwilioQuest Starter Template Node

// Return an XML response to this request
  res.set('Content-Type','text/xml');
Related