anchor.diff:  -spec get_file(req(), #state{}) -> {term(), req(), #state{}}.
   %% ====================================================================
   get_file(Req, #state{opts = Opts, attributes = #fileattributes{type = "REG"}} = State) ->
  -    DirCdmi = prepare_object_ans(State,case Opts of [] -> ?default_get_file_opts; _ -> Opts end),
  +    DirCdmi = prepare_object_ans(case Opts of [] -> ?default_get_file_opts; _ -> Opts end, State),
       case proplists:get_value(<<"value">>, DirCdmi) of
           {range, Range} ->
               Encoding = <<"base64">>, %todo send also utf-8 when possible
  
positive.code: %% ====================================================================
  %% @doc Prepares json formatted answer with field names from given list of binaries
  %% @end
  -spec prepare_container_ans(#state{}, [FieldName :: binary()]) -> [{FieldName :: binary(), Value :: term()}].
  %% ====================================================================
  prepare_container_ans(_State,[]) ->
      [];
  prepare_container_ans(State,[<<"objectType">> | Tail]) ->
      [{<<"objectType">>, <<"application/cdmi-container">>} | prepare_container_ans(State, Tail)];
  prepare_container_ans(#state{filepath = Filepath} = State,[<<"objectName">> | Tail]) ->
      [{<<"objectName">>, list_to_binary([filename:basename(Filepath),"/"])} | prepare_container_ans(State, Tail)];
  prepare_container_ans(#state{filepath = <<"/">>} = State,[<<"parentURI">> | Tail]) ->
      [{<<"parentURI">>, <<>>} | prepare_container_ans(State, Tail)];
  prepare_container_ans(#state{filepath = Filepath} = State,[<<"parentURI">> | Tail]) ->
      [{<<"parentURI">>, list_to_binary(fslogic_path:strip_path_leaf(Filepath))} | prepare_container_ans(State, Tail)];
  prepare_container_ans(State,[<<"completionStatus">> | Tail]) ->
      [{<<"completionStatus">>, <<"Complete">>} | prepare_container_ans(State, Tail)];
  prepare_container_ans(State,[<<"metadata">> | Tail]) -> %todo extract metadata
      [{<<"metadata">>, <<>>} | prepare_container_ans(State, Tail)];
  prepare_container_ans(#state{filepath = Filepath} = State,[<<"children">> | Tail]) ->
      [{<<"children">>, [list_to_binary(Path) || Path <- rest_utils:list_dir(Filepath)]} | prepare_container_ans(State, Tail)];
  prepare_container_ans(State,[Other | Tail]) ->
      [{Other, <<>>} | prepare_container_ans(State, Tail)].
  
  %% prepare_object_ans/2
  %% ====================================================================
  %% @doc Prepares json formatted answer with field names from given list of binaries
  %% @end
  -spec prepare_object_ans(#state{}, [FieldName :: binary()]) -> [{FieldName :: binary(), Value :: term()}].
  %% ====================================================================
  prepare_object_ans(_State,[]) ->
      [];
  prepare_object_ans(State,[<<"objectType">> | Tail]) ->
      [{<<"objectType">>, <<"application/cdmi-object">>} | prepare_object_ans(State, Tail)];
  prepare_object_ans(#state{filepath = Filepath} = State,[<<"objectName">> | Tail]) ->
      [{<<"objectName">>, list_to_binary(filename:basename(Filepath))} | prepare_object_ans(State, Tail)];
  prepare_object_ans(#state{filepath = <<"/">>} = State,[<<"parentURI">> | Tail]) ->
      [{<<"parentURI">>, <<>>} | prepare_object_ans(State, Tail)];
  prepare_object_ans(#state{filepath = Filepath} = State,[<<"parentURI">> | Tail]) ->
      [{<<"parentURI">>, list_to_binary(fslogic_path:strip_path_leaf(Filepath))} | prepare_object_ans(State, Tail)];
  prepare_object_ans(State,[<<"completionStatus">> | Tail]) ->
      [{<<"completionStatus">>, <<"Complete">>} | prepare_object_ans(State, Tail)];
  prepare_object_ans(#state{filepath = Filepath} = State,[<<"mimetype">> | Tail]) ->
      {Type, Subtype, _} = cow_mimetypes:all(gui_str:to_binary(Filepath)),
      [{<<"mimetype">>, <<Type/binary, "/", Subtype/binary>>} | prepare_object_ans(State, Tail)];
  prepare_object_ans(State,[<<"metadata">> | Tail]) -> %todo extract metadata
      [{<<"metadata">>, <<>>} | prepare_object_ans(State, Tail)];
  prepare_object_ans(State,[<<"valuetransferencoding">> | Tail]) ->
      [{<<"valuetransferencoding">>, <<"base64">>} | prepare_object_ans(State, Tail)];
  prepare_object_ans(State,[<<"value">> | Tail]) ->
      [{<<"value">>, {range, default}} | prepare_object_ans(State, Tail)];
  prepare_object_ans(State,[{<<"value">>,From,To} | Tail]) ->
      [{<<"value">>, {range, {From,To}}} | prepare_object_ans(State, Tail)];
  prepare_object_ans(#state{opts = Opts,attributes = Attrs} = State,[<<"valuerange">> | Tail]) ->
      case lists:keyfind(<<"value">>,1,Opts) of
          {<<"value">>,From,To} ->
              [{<<"valuerange">>, iolist_to_binary([integer_to_binary(From),<<"-">>,integer_to_binary(To)])} | prepare_object_ans(State, Tail)];
          _ ->
              [{<<"valuerange">>, iolist_to_binary([<<"0-">>,integer_to_binary(Attrs#fileattributes.size-1)])} | prepare_object_ans(State, Tail)]
      end;
  prepare_object_ans(State,[Other | Tail]) ->
      [{Other, <<>>} | prepare_object_ans(State, Tail)].
  
  %% parse_opts/1
  %% ====================================================================
  
negative.code: put_dir(Req, #state{filepath = Filepath, body = _Body} = State) ->
      case logical_files_manager:mkdir(Filepath) of
          ok -> %todo check given body
              Response = rest_utils:encode_to_json({struct, prepare_container_ans(?default_post_dir_opts,State)}),
              Req2 = cowboy_req:set_resp_body(Response,Req),
              {true,Req2,State};
          {error, dir_exists} ->
  