From 7c29e60b4c60f6f23d37a5882a6687483597f178 Mon Sep 17 00:00:00 2001 From: johannes-kostas goetzinger Date: Mon, 3 Jun 2019 12:40:26 +0200 Subject: [PATCH] if protocol empty, fall back to extract it from the url instead --- superdebug-browser.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/superdebug-browser.js b/superdebug-browser.js index 762f7f4..9ce250a 100644 --- a/superdebug-browser.js +++ b/superdebug-browser.js @@ -49,7 +49,12 @@ function handleResponse (request, start, logger, debugLog, debugCurl) { var now = new Date().getTime() var elapsed = now - start var elapseTime = elapsed + 'ms' - var protocol = request.protocol.toUpperCase().replace(/[^\w]/g, '') + var requestProtocol = request.protocol + if (!requestProtocol) { + var match = /^\w+/i.exec(request.url) + requestProtocol = match && match[0] || '' + } + var protocol = requestProtocol.toUpperCase().replace(/[^\w]/g, '') var requestMethod = request.method.toUpperCase() var curl = formatToCurl(request, request.url)