added trimming in contenttype
added accept header parsing
added validation and error handling in accept & content-type headers
added missing return nil
added accept & content-type parsing in server