From b147becb791f5ff74fe926e3d291a9fa20a64243 Mon Sep 17 00:00:00 2001 From: Grant Timmerman Date: Wed, 6 May 2020 11:59:48 -0700 Subject: [PATCH] Revert "fix: make application/json the default content type in binary mode (#118)" This reverts commit 9ccfaf25baa871f680ae755b6a2d8334aef4c517. Signed-off-by: Grant Timmerman --- lib/bindings/http/receiver_binary.js | 5 ----- test/bindings/http/receiver_binary_0_3_tests.js | 14 -------------- test/bindings/http/receiver_binary_1_tests.js | 14 -------------- 3 files changed, 33 deletions(-) diff --git a/lib/bindings/http/receiver_binary.js b/lib/bindings/http/receiver_binary.js index 71a0c80c..0aecc2ec 100644 --- a/lib/bindings/http/receiver_binary.js +++ b/lib/bindings/http/receiver_binary.js @@ -52,11 +52,6 @@ BinaryHTTPReceiver.prototype.check = function(payload, headers) { // Clone and low case all headers names const sanityHeaders = Commons.sanityAndClone(headers); - // If no content type is provided, default to application/json - if (!sanityHeaders[Constants.HEADER_CONTENT_TYPE]) { - sanityHeaders[Constants.HEADER_CONTENT_TYPE] = Constants.MIME_JSON; - } - // Validation Level 1 if (!this.allowedContentTypes .includes(sanityHeaders[Constants.HEADER_CONTENT_TYPE])) { diff --git a/test/bindings/http/receiver_binary_0_3_tests.js b/test/bindings/http/receiver_binary_0_3_tests.js index 89580cf1..86467c14 100644 --- a/test/bindings/http/receiver_binary_0_3_tests.js +++ b/test/bindings/http/receiver_binary_0_3_tests.js @@ -144,20 +144,6 @@ describe("HTTP Transport Binding Binary Receiver for CloudEvents v0.3", () => { expect(receiver.check.bind(receiver, payload, attributes)) .to.not.throw(); }); - - it("No error when content-type is unspecified", () => { - const payload = {}; - const attributes = { - "ce-type": "type", - "ce-specversion": "0.3", - "ce-source": "source", - "ce-id": "id" - }; - - // act and assert - expect(receiver.check.bind(receiver, payload, attributes)) - .to.not.throw(); - }); }); describe("Parse", () => { diff --git a/test/bindings/http/receiver_binary_1_tests.js b/test/bindings/http/receiver_binary_1_tests.js index 9ee2444b..6d778150 100644 --- a/test/bindings/http/receiver_binary_1_tests.js +++ b/test/bindings/http/receiver_binary_1_tests.js @@ -130,20 +130,6 @@ describe("HTTP Transport Binding Binary Receiver for CloudEvents v1.0", () => { .to.throw("invalid content type"); }); - it("No error when content-type is unspecified", () => { - const payload = {}; - const attributes = { - "ce-type": "type", - "ce-specversion": "1.0", - "ce-source": "source", - "ce-id": "id" - }; - - // act and assert - expect(receiver.check.bind(receiver, payload, attributes)) - .to.not.throw(); - }); - it("No error when all required headers are in place", () => { // setup const payload = {};