fixup: remove stray comment/optimize regex
Signed-off-by: Lance Ball <lball@redhat.com>
This commit is contained in:
parent
82a5f070b5
commit
681d4a4280
|
|
@ -637,15 +637,6 @@
|
|||
"ajv": "*"
|
||||
}
|
||||
},
|
||||
"@types/axios": {
|
||||
"version": "0.14.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/axios/-/axios-0.14.0.tgz",
|
||||
"integrity": "sha1-7CMA++fX3d1+udOr+HmZlkyvzkY=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"axios": "*"
|
||||
}
|
||||
},
|
||||
"@types/cacheable-request": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.1.tgz",
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ export class JSONParser implements Parser {
|
|||
// This is kind of a hack, but the payload data could be JSON in the form of a single
|
||||
// string, such as "some data". But without the quotes in the string, JSON.parse blows
|
||||
// up. We can check for this scenario and add quotes. Not sure if this is ideal.
|
||||
const r = /^[[|{|"]/;
|
||||
if (!r.test(payload)) {
|
||||
if (!/^[[|{|"]/.test(payload)) {
|
||||
payload = `"${payload}"`;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ describe("JSON Event Format Parser", () => {
|
|||
const payload = "I am a string!";
|
||||
const parser = new Parser();
|
||||
|
||||
// TODO: Should the parser catch the SyntaxError and re-throw a ValidationError?
|
||||
expect(parser.parse(payload)).to.equal("I am a string!");
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue