translators icon indicating copy to clipboard operation
translators copied to clipboard

handle HTTP status code 300 in unAPI

Open eroux opened this issue 3 years ago • 4 comments

In my current implementation of unAPI endpoint (which will change soon because of this bug, sorry), URLs with IDs and no format such as https://ldspdi.bdrc.io/UNAPI?id=bdr:MW22084 return a HTTP 300 status code, as recommended in the spec:

 unAPI defers to the response status codes already defined in HTTP [RFC 2616] to indicate the success or failure of an operation. In particular, it is recommended that unAPI implementors utilize the following:

-   300 Multiple Choices for the UNAPI?id=IDENTIFIER function

But the unAPI translator doesn't work and the debug output says:

Error: HTTP request to https://ldspdi.bdrc.io/UNAPI?id=bdr:MW22084 rejected with status 300 messaging_inject.js:79:17

I think it shouldn't consider 300 as an error automatically.

eroux avatar Jun 16 '21 11:06 eroux

Thanks for reporting. We can have it treat 300 as a success. Could you link me to a page that's currently failing?

AbeJellinek avatar Jun 16 '21 17:06 AbeJellinek

well, unfortunately I can't anymore as I've changed our server... but I can hack something

eroux avatar Jun 16 '21 17:06 eroux

If returning status 300 is consistent with the spec, then please keep doing it! I can just push an update for the translator.

AbeJellinek avatar Jun 16 '21 17:06 AbeJellinek

here's a page that uses an unAPI endpoint that returns a 300: https://eroux.fr/testunapi300.html I'm still getting the error message but...! contrary to my previous assumption, Zotero seems to work and finds what it's supposed to find... so I guess something must have been off in my earlier testing sorry! In any case, it's probably best not to consider a 300 an error, at least in that case

eroux avatar Jun 16 '21 17:06 eroux