From 254bcbd666f32ddc9e0faf269d01fa8bee89f8a9 Mon Sep 17 00:00:00 2001 From: Francesco Cozzuto Date: Mon, 21 Jul 2025 22:52:00 +0200 Subject: [PATCH] Update README --- README.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b90f1e8..831aa19 100644 --- a/README.md +++ b/README.md @@ -6,26 +6,24 @@ Here are some examples of how it looks like on the client and server. If you wan Here is a client performing a GET request: ```c +#include #include int main(void) { http_global_init(); + HTTP_String url = HTTP_STR("http://example.com/index.html"); + HTTP_String headers[] = { HTTP_STR("User-Agent: cHTTP"), }; - HTTP_RequestHandle handle; - HTTP_Response *res = http_get( - HTTP_STR("http://example.com/index.html"), - headers, HTTP_COUNT(headers), - &handle - ); + HTTP_Response *res = http_get(url, headers, 1); - fwrite(res->body.ptr, 1, res->body.ptr, stdout); + fwrite(res->body.ptr, 1, res->body.len, stdout); - http_request_free(handle); + http_response_free(res); http_global_free(); return 0; }