4.3. Specifying Client Behaviour
4.3. Specifying Client Behaviour
The client's requirements define what implementations need to do to be compliant. When specifying client behaviour, it's essential to clearly define:
-
what requests the client should make and what responses it should expect;
-
what protocol elements (methods, status codes, header fields, and content) the client should send and expect; and
-
how the client should handle unexpected responses.
Specifications SHOULD NOT prohibit clients from making requests not explicitly specified, nor should they prohibit servers from accepting them. This allows the application to evolve.
However, specifications SHOULD give guidance about handling responses from servers that don't conform to their expectations. For example, a specification might say that if a client makes a request expecting a 200 OK response but receives a 404 Not Found response instead, it should consider the request to have failed.