Closed sypets closed 1 year ago
Thanks for reporting this. getUsage
should use a GET request, as per the API docs. I am fixing this in all client libraries.
(commit with the fix)
Reopened due to no release tag yet
Released a new version 1.4.0 that includes this fix, among some other changes, see CHANGELOG.md
I had some problems using this client library. Specifically, the
Translator::getUsage()
call worked on a development system, but not on other machine (with the same software package). Everything else worked very reliably.The problem that occurs is that the
getUsage
request returns 400 HTTP status code (bad request).I can reproduce this consistently, I even created a small test script with (basically) the same code.
After some tests I could narrow it down:
All systems use
Always worked:
Translator::listGlossaries()
Translator::getGlossaryEntries()
Translator::createGlossary()
Problems on some machines:
The problems occured on:
Ok:
Suspected problem
getUsage
is the only call that uses POST request, not GETContent-Type
header is not set and alsoCURLOPT_POSTFIELDS
is not set. I assume that my different cURL libs handle that differently.Resproduce
It is a little difficult to reproduce because the problem does not manifest itself on all systems and I am not sure what is the relevant setting.
Possible solution
Ideally, figure out exact reason why server sends 404. However, this also seems to fix the problem:
in
HttpClient::sendRequest
Additional information
I activated logging and also have a test script which reproduces the problem on the affected machines and outputs some more information. I can upload the logs if requested.
The test script is here: https://github.com/sypets/sypets_test_deepl_usage_standalone