anchor.diff:  %% @end
   -spec validate_request(message()) -> ok | {error, Reason :: term()}.
   validate_request(Request) when is_record(Request, sip_message) ->
  +    {request, Method, _} = Request#sip_message.start_line,
       CountFun =
           fun ({Name, Value}, Counts) ->
                    % assign tuple index for every header being counted
  
positive.code:         end,
  
      % Count headers
      case lists:foldl(CountFun, {0, 0, 0, 0, 0, 0}, Request#sip_message.headers) of
          C when C >= {1, 1, 1, 1, 1, 1}, % Each header must be exactly once,
                 C =< {1, 1, 1, 1, 1, a}  % except Via:, which must be at least once (atom > every possible number)
            -> ok;
          _ -> {error, invalid_headers}
      end.
  
negative.code:                                        {'via', [Via1Up]},
                                         {'via', [Via2]}]},
      NoViaMsg = #sip_message{headers = [{'content-length', 123}, {'cseq', CSeq}]},
  
      URI = <<"sip@nowhere.invalid">>,
      ValidRequest =
          #sip_message{start_line = {request, 'OPTIONS', URI},
                       headers = [{to, sip_headers:address(<<>>, URI, [])},
                                  {from, sip_headers:address(<<>>, URI, [])},
                                  {cseq, sip_headers:cseq(1, 'OPTIONS')},
                                  {'call-id', <<"123">>},
                                  {'max-forwards', 70},
                                  {via, sip_headers:via(udp, <<"localhost">>, [])}]},
  
      % No contact in INVITE
      InvalidRequest =
          ValidRequest#sip_message{start_line = {request, 'INVITE', URI}},
      [% Header lookup functions
       ?_assertEqual({ok, Via1}, top_header('via', [{'via', [Via1, Via2]}])),
       ?_assertEqual({ok, <<"z9hG4bK776asdhds">>}, top_via_branch(#sip_message{headers = [{'via', [Via1]}, {'via', [Via2]}]})),
  