<commit_before>-module(example_default).

-export(
   [
    init/3,
    rest_init/2,
    content_types_accepted/2,
    content_types_provided/2,
    forbidden/2,
    resource_exists/2
   ]
  ).

%% cowboy
init(_Transport, _Req, _Opts) ->
    {upgrade, protocol, cowboy_rest}.

rest_init(Req, _Opts) ->
    {ok, Req, #{}}.

content_types_accepted(Req, State) ->
  {Method, Req1} = cowboy_req:method(Req),
  HandleMethod = case Method of
                     <<"PUT">> ->
                         handle_put;
                     <<"POST">> ->
                         handle_post
                 end,
  {[{<<"text/plain">>, HandleMethod}], Req1, State}.

content_types_provided(Req, State) ->
    {[{{<<"application">>, <<"erlang">>, []}, handle_get}], Req, State}.

forbidden(Req, State) ->
    {false, Req, State}.

resource_exists(Req, State) ->
    {Method, Req1} = cowboy_req:method(Req),
    {Method =/= <<"POST">>, Req1, State}.<commit_msg>[#24] Changed content_types_provided to text/plain<commit_after>-module(example_default).

-export(
   [
    init/3,
    rest_init/2,
    content_types_accepted/2,
    content_types_provided/2,
    forbidden/2,
    resource_exists/2
   ]
  ).

%% cowboy
init(_Transport, _Req, _Opts) ->
    {upgrade, protocol, cowboy_rest}.

rest_init(Req, _Opts) ->
    {ok, Req, #{}}.

content_types_accepted(Req, State) ->
  {Method, Req1} = cowboy_req:method(Req),
  HandleMethod = case Method of
                     <<"PUT">> ->
                         handle_put;
                     <<"POST">> ->
                         handle_post
                 end,
  {[{<<"text/plain">>, HandleMethod}], Req1, State}.

content_types_provided(Req, State) ->
    {[{{<<"application">>, <<"text/plain">>, []}, handle_get}], Req, State}.

forbidden(Req, State) ->
    {false, Req, State}.

resource_exists(Req, State) ->
    {Method, Req1} = cowboy_req:method(Req),
    {Method =/= <<"POST">>, Req1, State}.
{'fraction_non_alphanumeric': 0.1772609819121447, 'fraction_numerical': 0.011369509043927648, 'mean_word_length': 2.426548672566372, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6622549', 'n_tokens_mistral': 698, 'n_tokens_neox': 680, 'n_words': 119}