diff --git a/src/input/plugins/TidalLoginRequest.cxx b/src/input/plugins/TidalLoginRequest.cxx index 4b1671298..71e4ce7e6 100644 --- a/src/input/plugins/TidalLoginRequest.cxx +++ b/src/input/plugins/TidalLoginRequest.cxx @@ -49,7 +49,6 @@ TidalLoginRequest::TidalLoginRequest(CurlGlobal &curl, const char *username, const char *password, TidalLoginHandler &_handler) noexcept :request(curl, MakeLoginUrl(base_url).c_str(), *this), - parser(&parse_callbacks, nullptr, this), handler(_handler) { request_headers.Append((std::string("X-Tidal-Token:") @@ -76,6 +75,8 @@ TidalLoginRequest::OnHeaders(unsigned status, auto i = headers.find("content-type"); if (i == headers.end() || i->second.find("/json") == i->second.npos) throw std::runtime_error("Not a JSON response from Tidal"); + + parser = {&parse_callbacks, nullptr, this}; } void diff --git a/src/input/plugins/TidalTrackRequest.cxx b/src/input/plugins/TidalTrackRequest.cxx index d009a61a1..c0b8d540d 100644 --- a/src/input/plugins/TidalTrackRequest.cxx +++ b/src/input/plugins/TidalTrackRequest.cxx @@ -53,7 +53,6 @@ TidalTrackRequest::TidalTrackRequest(CurlGlobal &curl, const char *track_id, TidalTrackHandler &_handler) noexcept :request(curl, MakeTrackUrl(base_url, track_id).c_str(), *this), - parser(&parse_callbacks, nullptr, this), handler(_handler) { request_headers.Append((std::string("X-Tidal-Token:") @@ -78,6 +77,8 @@ TidalTrackRequest::OnHeaders(unsigned status, auto i = headers.find("content-type"); if (i == headers.end() || i->second.find("/json") == i->second.npos) throw std::runtime_error("Not a JSON response from Tidal"); + + parser = {&parse_callbacks, nullptr, this}; } void