Includes refactoring marketplace item tester into a single-page app.
Showing the changes to libraries/script-engine/src/XMLHttpRequestClass.cpp (1 of 39 files). Show all
Unified · Split
| @@ -21,6 +21,7 @@ · 20 unmodified lines | |||
| 21 | #include <NetworkAccessManager.h> | 21 | #include <NetworkAccessManager.h> |
| 22 | #include <NetworkingConstants.h> | 22 | #include <NetworkingConstants.h> |
| 23 | 23 | ||
| 24 | #include "ResourceRequestObserver.h" | ||
| 24 | #include "ScriptEngine.h" | 25 | #include "ScriptEngine.h" |
| 25 | 26 | ||
| 26 | const QString METAVERSE_API_URL = NetworkingConstants::METAVERSE_SERVER_URL().toString() + "/api/"; | 27 | const QString METAVERSE_API_URL = NetworkingConstants::METAVERSE_SERVER_URL().toString() + "/api/"; |
| @@ -62,7 +63,7 @@ QScriptValue XMLHttpRequestClass::constructor(QScriptContext* context, QScriptEn · 35 unmodified lines | |||
| 62 | QScriptValue XMLHttpRequestClass::getStatus() const { | 63 | QScriptValue XMLHttpRequestClass::getStatus() const { |
| 63 | if (_reply) { | 64 | if (_reply) { |
| 64 | return QScriptValue(_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()); | 65 | return QScriptValue(_reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()); |
| 65 | } | 66 | } |
| 66 | return QScriptValue(0); | 67 | return QScriptValue(0); |
| 67 | } | 68 | } |
| 68 | 69 | ||
| @@ -143,7 +144,7 @@ void XMLHttpRequestClass::open(const QString& method, const QString& url, bool a · 74 unmodified lines | |||
| 143 | 144 | ||
| 144 | if (url.toLower().left(METAVERSE_API_URL.length()) == METAVERSE_API_URL) { | 145 | if (url.toLower().left(METAVERSE_API_URL.length()) == METAVERSE_API_URL) { |
| 145 | auto accountManager = DependencyManager::get<AccountManager>(); | 146 | auto accountManager = DependencyManager::get<AccountManager>(); |
| 146 | 147 | ||
| 147 | if (accountManager->hasValidAccessToken()) { | 148 | if (accountManager->hasValidAccessToken()) { |
| 148 | static const QString HTTP_AUTHORIZATION_HEADER = "Authorization"; | 149 | static const QString HTTP_AUTHORIZATION_HEADER = "Authorization"; |
| 149 | QString bearerString = "Bearer " + accountManager->getAccountInfo().getAccessToken().token; | 150 | QString bearerString = "Bearer " + accountManager->getAccountInfo().getAccessToken().token; |
| @@ -189,7 +190,7 @@ void XMLHttpRequestClass::send(const QScriptValue& data) { · 39 unmodified lines | |||
| 189 | } | 190 | } |
| 190 | 191 | ||
| 191 | void XMLHttpRequestClass::doSend() { | 192 | void XMLHttpRequestClass::doSend() { |
| 192 | 193 | DependencyManager::get<ResourceRequestObserver>()->update(_url, -1, "XMLHttpRequestClass::doSend"); | |
| 193 | _reply = NetworkAccessManager::getInstance().sendCustomRequest(_request, _method.toLatin1(), _sendData); | 194 | _reply = NetworkAccessManager::getInstance().sendCustomRequest(_request, _method.toLatin1(), _sendData); |
| 194 | connectToReply(_reply); | 195 | connectToReply(_reply); |
| 195 | 196 | ||