`Node "invoke_test_lenient_flags" has no '.otherwise()'` in test
cloewen8 opened this issue · 1 comments
My goal is to add NTRIP support to llhttp to contribute for an upstream dependency (apple/swift-nio#2260 (review)). NTRIP is an HTTP based standard for transmitting high-accuracy positioning data over the internet.
To do so, I need to add 2 additional response schemas (SOURCETABLE and ICY, aliases for HTTP/1.1) and interpret \u{D3}
as the start of a response body instead of a header (some older servers discard the extra CRLF after the status-line). I believe I can implement this without misinterpreting invalid responses as NTRIP by hiding this behind a lenient flag.
This is going well so far but I ran into an AssertionError [ERR_ASSERTION]: Node "invoke_test_lenient_flags" has no '.otherwise()'
error while running tests. It started occurring after I had added a new lenient flag (LENIENT_FLAGS.NTRIP
). Example:
.match('SOURCETABLE', this.testLenientFlags(LENIENT_FLAGS.NTRIP, {
1: this.update('type', TYPE.RESPONSE, 'res_ntrip_major')
}))
The flag was added to the LENIENT_FLAGS enum, the TestType in md-test.ts and test/fixtures/index.ts. Am I missing anything else to get this working?
Hello!
Yes, the problem is that your this.testLenientFlags
has no "otherwise" node, which means that the state machine has no possible end.
The solution is to add a destination node after your possible flags, like this:
.match(
'SOURCETABLE',
this.testLenientFlags(
LENIENT_FLAGS.NTRIP,
{
1: this.update('type', TYPE.RESPONSE, 'res_ntrip_major')
},
n('res_ntrip_failed') // or p.error(ERROR.SOMETHING, 'Some message')
)
)
For now I'm closing this as there's nothing to do from llhttp here. Feel free to reopen if you don't agree.