gmail-automata icon indicating copy to clipboard operation
gmail-automata copied to clipboard

Match arbitrary header

Open mlsad3 opened this issue 2 years ago • 1 comments

Match on arbitrary header and value.

Resolves #36, allows matching on any header and value.

(header X-Custom-Header /value/)

As we use GmailMessage.getHeader function, the header name used in the condition must be case-sensitive.

Overall flow:

  • Rules are parsed, and a list of condition-requested-headers is created.
  • ThreadData reads in the message data, and all the headers that were requested in the rules (we have to pass SessionData to ThreadData so it knows which headers to search).
  • Condition.match checks what header to match with, and compares the header's value with the rule's value.

In order to get the SessionData.mock.ts to work, SessionData.labels had to be made public. This seems to be a limitation we will continue to hit in testing if we want to test on Sheet Apps, since we cannot use other better libraries.

NOTE: This utilizes @aaronj1335 's Utils PR (or I could not run anything). NOTE2: This also utilizes my #65 Refactor tests, so that we can more easily test this feature.

mlsad3 avatar Aug 05 '22 06:08 mlsad3

Hi @ranmocy ,

Any thoughts on this PR?

mlsad3 avatar Nov 08 '22 16:11 mlsad3