-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathmain.cpp
More file actions
32 lines (23 loc) · 718 Bytes
/
main.cpp
File metadata and controls
32 lines (23 loc) · 718 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <nodepp/nodepp.h>
#include <nodepp/https.h>
using namespace nodepp;
void onMain(){
ssl_t ssl; // ( "./ssl/cert.key", "./ssl/cert.crt" );
fetch_t args;
args.method = "GET";
args.url = "https://www.google.com/";
args.headers = header_t({
{ "Host", url::host(args.url) }
});
// args.file = file_t("PATH","r");
// args.body = "MYBODY";
https::fetch( args, &ssl )
.then([]( https_t cli ){
cli.onData([]( string_t chunk ){
console::log( chunk.size(), ":>", chunk );
}); stream::pipe( cli );
})
.fail([]( except_t err ){
console::error( err );
});
}