I have added versioning for the media types (xml/json) supported in my ReST services. The Accept header of the incoming request should have a media type with valid version to get a proper response in the specified format. The problem is that if the request contains a valid data format in the accept header but an invalid version (or no version specified) I have to give error response in that particular data format.
For example, let the valid media types be application/xml+v2 and application/json+v2. If the request header contains only application/xml or application/xml+v1 I have to give error response in xml and if the header contains application/json+v1 I have to give error response in json.