Skip to content

Commit

Permalink
remove useless functino
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitc committed Apr 17, 2014
1 parent 4c01822 commit 48a5a3f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
15 changes: 0 additions & 15 deletions src/hackney_bstr.erl
Expand Up @@ -22,8 +22,6 @@
alpha/2,
word/2]).

-export([content_type/1]).

-export([quoted_string/2]).

to_binary(V) when is_list(V) ->
Expand Down Expand Up @@ -342,19 +340,6 @@ word(Data, Fun) ->
(Rest, Token) -> Fun(Rest, Token)
end).

%% get content type
%%
%%
content_type(Name) ->
case mimetypes:filename(Name) of
[CT | _] ->
CT;
CT when is_binary(CT) ->
CT
end.



-spec quoted_string(binary(), fun()) -> any().
quoted_string(<< $", Rest/binary >>, Fun) ->
quoted_string(Rest, Fun, <<>>).
Expand Down
4 changes: 2 additions & 2 deletions src/hackney_multipart.erl
Expand Up @@ -226,7 +226,7 @@ mp_file_header({file, Path, ExtraHeaders}, Boundary) ->
{<<"filename">>, <<"\"", FName/binary, "\"">>}]},
mp_file_header({file, Path, Disposition, ExtraHeaders}, Boundary);
mp_file_header({file, Path, {Disposition, Params}, ExtraHeaders}, Boundary) ->
CType = hackney_bstr:content_type(Path),
CType = hackney_mimetypes:filename(Path),
Len = filelib:file_size(Path),
Headers = [{<<"Content-Disposition">>, Disposition, Params},
{<<"Content-Type">>, CType},
Expand All @@ -247,7 +247,7 @@ mp_data_header({Name, Len, ExtraHeaders}, Boundary) ->
<<"\"", Name/binary, "\"">>}]},
mp_data_header({Name, Len, Disposition, ExtraHeaders}, Boundary);
mp_data_header({Name, Len, {Disposition, Params}, ExtraHeaders}, Boundary) ->
CType = hackney_bstr:content_type(Name),
CType = hackney_mimetypes:filename(Name),
Headers = [{<<"Content-Disposition">>, Disposition, Params},
{<<"Content-Type">>, CType},
{<<"Content-Length">>, Len}] ++ ExtraHeaders,
Expand Down

0 comments on commit 48a5a3f

Please sign in to comment.