mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-10-30 19:34:14 +00:00
when app url is websocket we still need to send to http schema not ws (#439)
* when app url is websocket we still need to send to http schema not ws * fix bug from a previous PR
This commit is contained in:
1 parent
2b4b3056e9
commit
48e39f37d3
2 files changed
+12
-5
No files matched your search
@@ -12,8 +12,16 @@ const validateAppEnvSchema = (schema) => {
|
||||
|
||||
//Currently this request is not signed with the webhook secret as it is outside an account
|
||||
const fetchAppEnvSchema = async(logger, url) => {
|
||||
// Translate WebSocket URLs to HTTP equivalents (case-insensitive)
|
||||
let fetchUrl = url;
|
||||
if (url.toLowerCase().startsWith('ws://')) {
|
||||
fetchUrl = 'http://' + url.substring(5);
|
||||
} else if (url.toLowerCase().startsWith('wss://')) {
|
||||
fetchUrl = 'https://' + url.substring(6);
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
const response = await fetch(fetchUrl, {
|
||||
method: 'OPTIONS',
|
||||
headers: {
|
||||
Accept: 'application/json'
|
||||
|
||||
Reference in new issue
Block a user