Как добавить тип контента в Twilio Response? Я получаю ошибку 502 bad gateway, и ошибка говорит, что это может быть из-за отсутствия Content-Type. Но я вижу, что в ответе есть Content-type. Так что может быть не так? Я также вижу, что причина twilio - время соединения! Что это значит? Это связано с моей предыдущей публикации по адресу: An attempt to retrieve content from returned the HTTP status code 502. Please check the URL and try againКак добавить тип контента в ответ Twilio?
Response - The HTTP headers and body of your server's response to Twilio
Headers
Content-Type text/html
Transfer-Encoding chunked
X-Twilio-Reason connection timed out
Body
1
<html><head><title>502 Bad Gateway</title></head><body><h1>Bad Gateway</h1>An upstream server returned an invalid response.</body></html>
Может кто-нибудь помочь мне выяснить, почему Twilio дает ошибку при обращении к моей API? Это то, что у меня в контроллере:
public class TestController : ApiController
{
[HttpPost]
public HttpResponseMessage Post([FromBody]SmsRequest smsReq)
{
string smsReqUpper = smsReq.Body.ToUpper();
string testString = "TEST";
var response = new Twilio.TwiML.TwilioResponse();
if (smsReqUpper == testString)
{
response.Sms("Test Successful");
return Request.CreateResponse(HttpStatusCode.OK, response.Element);
}
else
{
string strBody = "Invalid Text Command. Please text the word TEST " ;
response.Sms(strBody);
return Request.CreateResponse(HttpStatusCode.OK, response.Element);
//return new TwiMLResult(response);
}
}
Я все еще застрял, и Twilio все еще дает ошибки. Любые указатели будут очень благодарны. Спасибо. – Ditty
Является ли приведенный выше код по крайней мере правильным? – Ditty