Closed
Description
#include <cpprest/http_client.h>
#include <nlohmann/json.hpp>
#include <iostream>
int main() {
web::uri_builder builder("http://xkcd.com/614/info.0.json"); // first builder
// web::uri_builder builder("http://i.jandan.net/?oxwlxojflwblxbsapi=jandan.get_duan_comments?page=25"); // second builder
web::http::client::http_client client(builder.to_uri());
nlohmann::json json = nlohmann::json::parse(client.request(web::http::methods::GET)
.get().extract_string().get());
std::cout << json << std::endl;
}
Second builder can run.
But when run first builder, i will get:
terminate called after throwing an instance of 'std::invalid_argument'
what(): parse error - unexpected end of input
[1] 2056 abort (core dumped) ./bin/xkcd_bot
Please help me! Thanks very much!