From 2ad224972496629f20b0a5472e2148be1bc336fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabio=20Jos=C3=A9?= Date: Tue, 6 Aug 2019 11:17:07 -0300 Subject: [PATCH] Remove comment code and check for string type of data attribute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabio José --- lib/specs/spec_0_3.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/specs/spec_0_3.js b/lib/specs/spec_0_3.js index a0a80a8..5dade5d 100644 --- a/lib/specs/spec_0_3.js +++ b/lib/specs/spec_0_3.js @@ -87,15 +87,6 @@ Spec03.prototype.check = function(ce){ throw {message: "invalid payload", errors: isValidAgainstSchema.errors}; } - Array.of(toCheck) - .filter((tc) => (typeof tc.data) !== "string") - .filter((tc) => tc["datacontentencoding"]) - .forEach((tc) => { - throw {message: "invalid payload", errors: [ - "Use 'datacontentencoding' when 'data' is a string" - ]}; - }); - Array.of(toCheck) .filter((tc) => tc["datacontentencoding"]) .map((tc) => tc["datacontentencoding"].toLocaleLowerCase("en-US")) @@ -108,6 +99,7 @@ Spec03.prototype.check = function(ce){ Array.of(toCheck) .filter((tc) => tc["datacontentencoding"]) + .filter((tc) => (typeof tc.data) === "string") .map((tc) => { let newtc = clone(tc); newtc.datacontentencoding =