Skip to content

Commit

Permalink
fix: yaml parser should set logic for valid types
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jan 8, 2019
1 parent 707cdd2 commit a115056
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parser/YamlParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { dictToMap } from 'src/utils/Map';
import { TYPE_JSON, TYPE_YAML } from 'src/utils/Mime';

export type YamlParserData = ParserData;
export const YAML_TYPES = [TYPE_JSON, TYPE_YAML];
export const YAML_TYPES = new Set([TYPE_JSON, TYPE_YAML]);

export class YamlParser extends BaseParser<YamlParserData> implements Parser {
constructor(options: BotServiceOptions<YamlParserData>) {
Expand All @@ -27,7 +27,7 @@ export class YamlParser extends BaseParser<YamlParserData> implements Parser {
}

public async decode(msg: Message): Promise<any> {
if (!YAML_TYPES.includes(msg.type)) {
if (!YAML_TYPES.has(msg.type)) {
throw new MimeTypeError(`body type (${msg.type}) must be one of ${YAML_TYPES}`);
}

Expand Down

0 comments on commit a115056

Please sign in to comment.