anchor.diff:  %-define(DEBUG, 1).
   -include("debug.hrl").
   
  -
  -% XXX: or use "application/octet-stream" Content-Type instead of
  -% "application/protobuf"?
   
   % XXX: set charset=UTF-8 in "Content-Type" response header for text (Piq), Json
   % and XML responses?
  
positive.code: % Utility functions
  %
  
  format_to_content_type('pb') -> "application/protobuf";
  format_to_content_type('json') -> "application/json";
  format_to_content_type('piq') -> "text/plain".
  
  
  content_type_to_format("application/protobuf") -> 'pb';
  content_type_to_format("application/json") -> 'json';
  content_type_to_format("text/plain") -> 'piq';
  content_type_to_format(_) -> 'undefined'.
  
negative.code:     IsKnownType =
          case wrq:get_req_header("content-type", ReqData) of
              "application/json" -> true;
              "application/x-protobuf" -> true;
              % allow content-type to be undefined when the body is empty
              'undefined' when IsEmptyBody -> true;
              _ -> false
  