This is a question related to https://social.msdn.microsoft.com/Forums/en-US/6e856136-9a39-4b98-a53d-7f8bce08e3a6/cors-support-for-bing-translate-api
Does the Microsoft Azure Translate API support CORS now?
This is a question related to https://social.msdn.microsoft.com/Forums/en-US/6e856136-9a39-4b98-a53d-7f8bce08e3a6/cors-support-for-bing-translate-api
Does the Microsoft Azure Translate API support CORS now?
The Microsoft Translator Text API appears to at least minimally now support CORS, in that it does at least seem to send the
Access-Control-Allow-Originheader in responses:I don’t personally have a valid
appidto test with—but if you do, I think you’ll find it’ll work:GETendpoints from the https://docs.microsofttranslator.com/text-translate.html docsappidparameter instead of theAuthorizationrequest headerIf may also work for the https://docs.microsofttranslator.com/text-translate.html
POSTendpoints—as long as your requests don’t use theAuthorizationrequest header or set aContent-Type.The problem with those headers is, they’ll trigger browsers to do a preflight
OPTIONSrequest:https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Preflighted_requests
And the problem with making calls to those API endpoints that trigger a preflight is, they don’t seem to respond to
OPTIONSrequests in a way that’ll cause browsers to see the preflight as a success.At https://docs.microsofttranslator.com/text-translate.html#!/default/post_TranslateArray I notice the docs say that endpoint expects a
POSTwith anapplication/xmlortext/xmlContent-Type, so if that endpoint doesn’t respond to preflightOPTIONSin the right way, that one won’t work.That’s because adding an
Content-Type: application/xmlorContent-Type: text/xmlheader to a request will definitely trigger browsers to do a preflightOPTIONSbefore thePOST.