Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Removed one mochiweb_request:accepts_content_type/1 function clause #50

Merged
merged 1 commit into from

2 participants

@fdmanana

This was not a necessary clause because the regexp replace operation
accepts iolists.

@fdmanana fdmanana Removed one mochiweb_request:accepts_content_type/1 function clause
This was not a necessary clause because the regexp replace operation
accepts iolists.
c661601
@etrepum etrepum merged commit a85a6e2 into mochi:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 17, 2011
  1. @fdmanana

    Removed one mochiweb_request:accepts_content_type/1 function clause

    fdmanana authored
    This was not a necessary clause because the regexp replace operation
    accepts iolists.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 2 deletions.
  1. +0 −2  src/mochiweb_request.erl
  2. +1 −0  src/mochiweb_request_tests.erl
View
2  src/mochiweb_request.erl
@@ -727,8 +727,6 @@ accepted_encodings(SupportedEncodings) ->
%% 5) For an "Accept" header with value "text/*; q=0.0, */*":
%% accepts_content_type("text/plain") -> false
%%
-accepts_content_type(ContentType) when is_binary(ContentType) ->
- accepts_content_type(binary_to_list(ContentType));
accepts_content_type(ContentType1) ->
ContentType = re:replace(ContentType1, "\\s", "", [global, {return, list}]),
AcceptHeader = case get_header_value("Accept") of
View
1  src/mochiweb_request_tests.erl
@@ -7,6 +7,7 @@ accepts_content_type_test() ->
Req1 = mochiweb_request:new(nil, 'GET', "/foo", {1, 1},
mochiweb_headers:make([{"Accept", "multipart/related"}])),
?assertEqual(true, Req1:accepts_content_type("multipart/related")),
+ ?assertEqual(true, Req1:accepts_content_type(<<"multipart/related">>)),
Req2 = mochiweb_request:new(nil, 'GET', "/foo", {1, 1},
mochiweb_headers:make([{"Accept", "text/html"}])),
Something went wrong with that request. Please try again.