how to get body of an http GET request

913 Views Asked by At

I am using proxygen and need to get the body of a HTTP "GET" request. I have to use the curlclient provided in the sample httpclient. Now, I have to use the present api of the library. But the curlclient is based on 2 classes: HTTPConnector and HTTPTransaction. Both of them dont have any function that I have found that can return body of the message. So, is there a way to do so? How can I do this?

EDIT: Thanks, I found it and got it working. Now I need to parse the JSON I got. I have written this :

folly::fbstring body;
body = curlClient.getBody();

folly::dynamic parsed_body =  folly::parseJson(body);

but it is throwing error on the gdb on the third line. what could be the reason?

error:

Program received signal SIGABRT, Aborted.
0x00007ffff6741c37 in __GI_raise (sig=sig@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
0

There are 0 best solutions below