diff --git a/lib/bindings/http/http_receiver.js b/lib/bindings/http/http_receiver.js index 866c7966..c121cd30 100644 --- a/lib/bindings/http/http_receiver.js +++ b/lib/bindings/http/http_receiver.js @@ -42,16 +42,14 @@ class HTTPReceiver { } function getMode(headers) { - let mode = "unknown"; const contentType = headers[HEADER_CONTENT_TYPE]; if (contentType && contentType.startsWith(MIME_CE)) { - mode = "structured"; - } else if (headers[BINARY_HEADERS_1.ID]) { - mode = "binary"; - } else { - throw new TypeError("no cloud event detected"); + return "structured"; + } + if (headers[BINARY_HEADERS_1.ID]) { + return "binary"; } - return mode; + throw new TypeError("no cloud event detected"); } function getVersion(mode, headers, body) {