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:
Dave Horton authored and GitHub committed 2025-05-08 13:41:36 -04:00
1 parent 2b4b3056e9
commit 48e39f37d3
2 files changed
+12 -5

No files matched your search

+9 -1
View File
@@ -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'