Expand HTTPS debug to include GET JSON responses

* Change debug flag from --debug-http to --debug-https as OneDrive only
uses HTTPS, not HTTP
* Expand --debug-https to print the JSON responses to GET operations.
This is to assist with debugging #334 where a change in the MS API
(https://github.com/OneDrive/onedrive-api-docs/issues/834) no longer
sends 'lastModifiedDateTime' with responses to some GET's. This issue
seems to manefest itself with OneDrive Business accounts currently.
This commit is contained in:
abraunegg 2018-04-15 20:02:39 +10:00
parent bdb0de51f3
commit 5cb92c01b9
2 changed files with 6 additions and 2 deletions

View file

@ -63,7 +63,7 @@ int main(string[] args)
"confdir", "Set the directory used to store the configuration files", &configDirName,
"create-directory", "Create a directory on OneDrive - no sync will be performed.", &createDirectory,
"destination-directory", "Destination directory for renamed or move on OneDrive - no sync will be performed.", &destinationDirectory,
"debug-http", "Debug OneDrive HTTP communication.", &debugHttp,
"debug-https", "Debug OneDrive HTTPS communication.", &debugHttp,
"download|d", "Only download remote changes", &downloadOnly,
"local-first", "Synchronize from the local directory source first, before downloading changes from OneDrive.", &localFirst,
"logout", "Logout the current user", &logout,

View file

@ -3,7 +3,7 @@ import std.datetime, std.exception, std.file, std.json, std.path;
import std.stdio, std.string, std.uni, std.uri;
import config;
static import log;
shared bool debugResponse = false;
private immutable {
string clientId = "22c49a0d-d21c-4792-aed1-8f163c982546";
@ -55,6 +55,7 @@ final class OneDriveApi
http = HTTP();
if (debugHttp) {
http.verbose = true;
.debugResponse = true;
}
}
@ -308,6 +309,9 @@ final class OneDriveApi
if (!skipToken) addAccessTokenHeader(); // HACK: requestUploadStatus
auto response = perform();
checkHttpCode(response);
if (.debugResponse){
log.vlog("OneDrive Response: ", response);
}
return response;
}