anchor.diff:      undefined -> throw({missing_parameter, K});
       V -> V
     end;
  +
  +get_parameter({list, K, Default}, Qs) ->
  +  case proplists:get_value(K, Qs) of
  +    undefined -> Default;
  +    L when is_list(L) -> L;
  +    _V -> Default
  +  end;
  +
   get_parameter({boolean, K, Default}, Qs) ->
     case proplists:get_value(K, Qs) of
       true  -> true;
  
positive.code:   lager:debug("method: ~p path ~p",[Method,Path]),
    {404, list_to_binary(" not found " ++ Path)}.
  
  handle_status(Req) -> 
    ?OK.
  
  handle_push(Req) -> 
    {ok, [{JsonParams,_}], _} = cowboy_req:body_qs(Req),
    [Params] = jsx:decode(JsonParams),
    lager:debug("json: ~p, decoded  ~p",[JsonParams,Params]),
    [MsgId,DeviceToken,Message,Badge,SoundFileName,Expiration,Extra,Type,Callback] = get_params(Params,[
      {binary,<<"msg_id">>, apns:message_id()},
      {string,<<"device_token">>},
      {string,<<"message">>},
      {integer,<<"badge">>, none},
      {string,<<"sound_file_name">>, none},
      {integer,<<"expiration">>, apns:expiry(86400)},
      {raw,<<"extra">>, []},
      {string,<<"push_type">>,"unknown"},
      {string, <<"callback">>, "undefined"}
    ]),
    SoundFileName2 = case SoundFileName of
      "none" -> none;
      Other -> Other
    end,
    Msg = #apns_msg{
      id     = MsgId,
      device_token = DeviceToken,
      alert  = Message,
      badge  = Badge,
      sound  = SoundFileName2,
      expiry = Expiration,
  
negative.code: -behaviour(cowboy_http_handler).
  
  -include_lib("apns/include/apns.hrl").
  -include_lib("apns/include/localized.hrl").
  -include_lib("include/pusherman_types.hrl").
  
  -export([init/3, handle/2, terminate/3]).
  