diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-11-19 17:57:41 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-11-19 17:57:41 +0900 |
commit | 5937127b73a82fc86f6546397373ce9dbaf4e560 (patch) | |
tree | 1e3b4e5ddd50e8a4b605e7e599591d47fe9bed55 /lib/jobs/basejob.h | |
parent | 1d57741c679ec3112ae45e833b8f152fa737b944 (diff) | |
download | libquotient-5937127b73a82fc86f6546397373ce9dbaf4e560.tar.gz libquotient-5937127b73a82fc86f6546397373ce9dbaf4e560.zip |
BaseJob: Don't send accessToken if not needed; send again on 401
The first part closes #358; the second part is a workaround for non-standard
cases when endpoints without security by the spec turn out to be secured
(in particular, the case of authenticating media servers).
Diffstat (limited to 'lib/jobs/basejob.h')
-rw-r--r-- | lib/jobs/basejob.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/jobs/basejob.h b/lib/jobs/basejob.h index c4da40f5..ecbec74a 100644 --- a/lib/jobs/basejob.h +++ b/lib/jobs/basejob.h @@ -60,6 +60,7 @@ public: NetworkError = 100, Timeout, TimeoutError = Timeout, + Unauthorised, ContentAccessError, NotFoundError, IncorrectRequest, @@ -113,7 +114,12 @@ public: struct Status { Status(StatusCode c) : code(c) {} Status(int c, QString m) : code(c), message(std::move(m)) {} - static Status fromHttpCode(int httpCode, QString msg = {}); + + static StatusCode fromHttpCode(int httpCode); + static Status fromHttpCode(int httpCode, QString msg) + { + return { fromHttpCode(httpCode), std::move(msg) }; + } bool good() const { return code < ErrorLevel; } QDebug dumpToLog(QDebug dbg) const; |