Commit 12a2285b authored by Max Kellermann's avatar Max Kellermann

input/tidal: create JSON parser on demand

parent 1c023eac
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment