http://ops.epo.org/3.1/rest-services/le ... S5582191.*
I get the following fault, which is perfectly OK, as I know how to deal with this.
Code: Select all
<fault>
<code>CLIENT.AmbiguousRequest</code>
<message>The request was ambiguous</message>
<details>
<cause>Ambiguous input: publication/docdb/JP.S5582191.*</cause>
<resolution>publication/docdb/JP.S5582191.A*</resolution>
<resolution>publication/docdb/JP.S5582191.U*</resolution>
</details>
</fault>
Code: Select all
code 413 == Request Entity Too Large
What's the problem with this
I can react to ordinary error codes using ordinary program flow. When I get an Exception, I should react differently to that instead of using it for program flow. This is generally considered a bad practice, but currently I am forced to.
The other thing is, you are abusing the error code 413. It is intended to signal to the client that the request which has been sent to the server is too large to be processed. e.g. if I sent a POST request which is in total 20 MB of size and your server says: No this request you sent to us is too large.
So when facing a 413 I should make my request physically smaller, reducing its' byte-count. Not the response amount
How to deal with this
Use proper error codes. For the case that the request is ambiguous, you could have a look at error code 300 or 303. That would be ideal. You could also send a custom 5xx error code, as the server is not able to resolve the given URL to a resource.