Skip to content

parse error - unexpected end of input #558

Description

@alienzj
#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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions