rest protocol detection: test Accept header first; use startswith for Content-Type match
Created originally on Bitbucket by cmcdaniel (Craig McDaniel)
Was already merged in Bitbucket before import, marked as merged by the import user
- Some json requests will have 'Accept' = 'application/json', but won't set the Content-Type, which may leave it at default 'text/plain'.
- The 'Content-Type' may be something like 'application/json; charset=utf-8', so use startswith rather than an exact match.