-
 defmodule Ewebmachine.Core do
   import Ewebmachine.Core.DSL
   import Ewebmachine.Core.API

      _ -> d(v3c3)
    end
  end
  ## Accept exists?
  decision v3c3 do
    p_types = for {type,_fun}<-resource_call(:content_types_provided), do: normalize_mtype(type)
    case h(get_header_val("accept")) do

      type -> h(set_metadata(:'content-type', type)); d(v3d4)
    end
  end
  @doc "Accept-Language exists?"
  decision v3d4, do:
    h(decision_test(h(get_header_val("accept-language")),nil, :v3e5, :v3d5))
  @doc "Acceptable Language available? %% WMACH-46 (do this as proper conneg)"
  decision v3d5, do:
    h(decision_test(resource_call(:language_available), true, :v3e5, 406))
  @doc "Accept-Charset exists?"
  decision v3e5 do
    case h(get_header_val("accept-charset")) do
      nil -> h(decision_test(h(choose_charset("*")),nil, 406, :v3f6))
      _ -> d(v3e6)
    end
  end
  @doc "Acceptable Charset available?"
  decision v3e6, do:
    h(decision_test(h(choose_charset(h(get_header_val("accept-charset")))),nil, 406, :v3f6))
  @doc """
  Accept-Encoding exists?
  also, set content-type header here, now that charset is chosen)
  """
  decision v3f6 do
    {type,subtype,params} = h(get_metadata(:'content-type'))
    params = (char=h(get_metadata(:'chosen-charset'))) && Dict.put(params,:charset,char) || params
