anchor.diff:               #{data := DataAcc, from := From, status_code
                  := StatusCode, headers := Headers} = State) ->
       NewData = <<DataAcc/binary, Data/binary>>,
  -    gen_fsm:reply(From, #{status_code => StatusCode,
  -                          headers => Headers,
  -                          body => NewData
  -                         }),
  +    Result= {ok, #{status_code => StatusCode,
  +                   headers => Headers,
  +                   body => NewData
  +                  }},
  +    gen_fsm:reply(From, Result),
       {next_state, at_rest, State};
   receive_data({gun_error, _Pid, StreamRef, _Reason},
                #{stream := StreamRef} = State) ->
  
positive.code: %% </ul>
  %% @end
  -spec get(pid(), string(), headers(), options()) -> result().
  get(Pid, Uri, Headers0, Options) ->
      #{handle_event := HandleEvent,
        async := IsAsync,
        async_mode := AsyncMode,
        headers := Headers} = process_options(Options, Headers0, get),
  
      Event = case IsAsync of
                  true ->
                      {get_async, {HandleEvent, AsyncMode}, {Uri, Headers, []}};
                  false ->
                      {get, {Uri, Headers, []}}
             end,
      StreamRef = gen_fsm:sync_send_event(Pid, Event),
      {ok, StreamRef}.
  
  %% @doc Performs a <strong>POST</strong> request to <code>Uri</code> using
  %% <code>Headers</code> and <code>Body</code> as the content data.
  -spec post(pid(), string(), headers(), iodata(), options()) -> result().
  post(Pid, Uri, Headers0, Body, Options) ->
      try
          #{handle_event := HandleEvent,
            headers := Headers} = process_options(Options, Headers0, post),
          Event = {post, {Uri, Headers, Body}},
          StreamRef = gen_fsm:sync_send_event(Pid, Event),
          {ok, StreamRef}
      catch
          _:Reason -> {error, Reason}
      end.
  
  %% @doc Performs a <strong>DELETE</strong> request to <code>Uri</code> using
  %% <code>Headers</code>.
  -spec delete(pid(), string(), headers(), options()) -> result().
  delete(Pid, Uri, Headers0, Options) ->
      try
          #{handle_event := HandleEvent,
            headers := Headers} = process_options(Options, Headers0, delete),
          Event = {delete, {Uri, Headers, []}},
          StreamRef = gen_fsm:sync_send_event(Pid, Event),
          {ok, StreamRef}
      catch
          _:Reason -> {error, Reason}
      end.
  
  %% @doc Performs a <strong>HEAD</strong> request to <code>Uri</code> using
  %% <code>Headers</code>.
  -spec head(pid(), string(), headers(), options()) -> result().
  head(Pid, Uri, Headers0, Options) ->
      try
          #{handle_event := HandleEvent,
            headers := Headers} = process_options(Options, Headers0, head),
          Event = {head, {Uri, Headers, []}},
          StreamRef = gen_fsm:sync_send_event(Pid, Event),
          {ok, StreamRef}
      catch
          _:Reason -> {error, Reason}
  
      end.
  %% @doc Performs a <strong>OPTIONS</strong> request to <code>Uri</code> using
  %% <code>Headers</code>.
  -spec options(pid(), string(), headers(), options()) -> result().
  options(Pid, Uri, Headers0, Options) ->
      try
          #{handle_event := HandleEvent,
            headers := Headers} = process_options(Options, Headers0, options),
          Event = {options, {Uri, Headers, []}},
          StreamRef = gen_fsm:sync_send_event(Pid, Event),
          {ok, StreamRef}
      catch
          _:Reason -> {error, Reason}
      end.
  
  %% @doc Performs a <strong>PATCH</strong> request to <code>Uri</code> using
  %% <code>Headers</code> and <code>Body</code> as the content data.
  -spec patch(pid(), string(), headers(), iodata(), options()) -> result().
  patch(Pid, Uri, Headers0, Body, Options) ->
      try
          #{handle_event := HandleEvent,
            headers := Headers} = process_options(Options, Headers0, patch),
          Event = {patch, {Uri, Headers, Body}},
          StreamRef = gen_fsm:sync_send_event(Pid, Event),
          {ok, StreamRef}
      catch
          _:Reason -> {error, Reason}
      end.
  
  %% @doc Performs a <strong>PUT</strong> request to <code>Uri</code> using
  %% <code>Headers</code> and <code>Body</code> as the content data.
  -spec put(pid(), string(), headers(), iodata(), options()) -> result().
  put(Pid, Uri, Headers0, Body, Options) ->
      try
          #{handle_event := HandleEvent,
            headers := Headers} = process_options(Options, Headers0, put),
          Event = {put, {Uri, Headers, Body}},
          StreamRef = gen_fsm:sync_send_event(Pid, Event),
          {ok, StreamRef}
      catch
          _:Reason -> {error, Reason}
      end.
  
  %% @doc Performs a request to <code>Uri</code> using the HTTP method
  %% specified by <code>Method</code>,  <code>Body</code> as the content data and
  %% <code>Headers</code> as the request's headers.
  -spec request(pid(), http_verb(), string(), headers(), iodata(), options()) ->
      result().
  request(Pid, Method, Uri, Headers0, Body, Options) ->
      try
          #{handle_event := HandleEvent,
            headers := Headers} = process_options(Options, Headers0, Method),
          Event = {Method, {Uri, Headers, Body}},
          Response = gen_fsm:sync_send_event(Pid, Event),
          {ok, Response}
      catch
          _:Reason -> {error, Reason}
      end.
  
negative.code:       StateName,
        State#{status_code := StatusCode, headers := Headers}
      };
  wait_response({gun_error, _Pid, _StreamRef, Error},
                #{from := From} = State) ->
      gen_fsm:reply(From, {error, Error}),
      {next_state, at_rest, State};
  wait_response(Event, State) ->
      {stop, {unexpected, Event}, State}.
  
  