The way I implemented it there never is an obligation to move the King out of check. It is just bad strategy to leave it in check, or move it into enemy check, as that would allow the opponent to capture it on the next move. It is only forbidden to move the King into friendly check. (Which would not result in a capture opportunity.) It is allowed to expose the King to a friendly check by moving other pieces, as for the opponent in his following turn this would be an enemy check that he'd better resolve. There is no difference there between a direct check and a discovered check.
So yes, it is legal, but losing. The blue Knight was pinned, and yet it moves away.
The way I implemented it there never is an obligation to move the King out of check. It is just bad strategy to leave it in check, or move it into enemy check, as that would allow the opponent to capture it on the next move. It is only forbidden to move the King into friendly check. (Which would not result in a capture opportunity.) It is allowed to expose the King to a friendly check by moving other pieces, as for the opponent in his following turn this would be an enemy check that he'd better resolve. There is no difference there between a direct check and a discovered check.
So yes, it is legal, but losing. The blue Knight was pinned, and yet it moves away.