Fixed issue where if / was not provided in the host value then it would not send the request. Fixed issue where song records are formatted correctly

This commit is contained in:
kdeng00
2019-08-01 20:55:09 -04:00
parent f81b481f38
commit 98748b383c
5 changed files with 40 additions and 46 deletions
+4 -2
View File
@@ -4,6 +4,7 @@
#include <fstream>
#include <cpr/cpr.h>
#include <nlohmann/json.hpp>
using std::cout;
using std::endl;
@@ -35,7 +36,6 @@ namespace Syncers
{
cout<<"fetching songs"<<endl;
auto url = api.url + "api/" + api.version + "/" + "song";
cout<<url<<endl;
auto auth = token.tokenType;
auth.append(" " + token.accessToken);
@@ -43,9 +43,11 @@ namespace Syncers
cpr::Header{{"authorization", auth},
});
auto songData = nlohmann::json::parse(r.text);
ofstream writeData{};
writeData.open("songs.json");
writeData<<r.text;
writeData<<songData.dump(4);
writeData.close();
}
}