#include <atomic>
#include <chrono>
#include <cstring>
#include <thread>
Go to the source code of this file.
|
#define | DART_EXPORT extern "C" __attribute__((visibility("default"))) __attribute((used)) |
|
◆ DART_EXPORT
#define DART_EXPORT extern "C" __attribute__((visibility("default"))) __attribute((used)) |
◆ http_get()
DART_EXPORT void http_get |
( |
const char * |
uri, |
|
|
void(*)(const char *) |
onResponse |
|
) |
| |
Definition at line 34 of file fake_http.cc.
34 {
35 std::thread([onResponse]() {
36 std::this_thread::sleep_for(std::chrono::seconds(3));
38 }).detach();
39}
constexpr char kExampleResponse[]
char * strdup(const char *str1)
◆ http_serve()
DART_EXPORT void http_serve |
( |
void(*)(const char *) |
onRequest | ) |
|
Definition at line 41 of file fake_http.cc.
41 {
42 std::thread([onRequest]() {
43 while (true) {
44 std::this_thread::sleep_for(std::chrono::seconds(1));
46 }
47 }).detach();
48}
constexpr char kExampleRequest[]
◆ kExampleRequest
constexpr char kExampleRequest[] |
|
constexpr |
Initial value:= R"(
GET / HTTP/1.1
Host: www.example.com
)"
Definition at line 17 of file fake_http.cc.
◆ kExampleResponse
constexpr char kExampleResponse[] |
|
constexpr |
Initial value:= R"(
HTTP/1.1 200 OK
Content-Length: 54
Content-Type: text/html; charset=UTF-8
<html>
<body>
Hello world!
</body>
</html>
)"
Definition at line 22 of file fake_http.cc.