gmail-automata
gmail-automata copied to clipboard
Match arbitrary header
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.
Hi @ranmocy ,
Any thoughts on this PR?