aboutsummaryrefslogtreecommitdiff
path: root/lib/jobs/basejob.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-11-19 17:57:41 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-11-19 17:57:41 +0900
commit5937127b73a82fc86f6546397373ce9dbaf4e560 (patch)
tree1e3b4e5ddd50e8a4b605e7e599591d47fe9bed55 /lib/jobs/basejob.h
parent1d57741c679ec3112ae45e833b8f152fa737b944 (diff)
downloadlibquotient-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.h8
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;