Skip to content

Glaze Http Client - Get Request: No data in response_body #2413

@stephenberry

Description

@stephenberry

Discussed in #2410

Originally posted by floyd3000 March 30, 2026
For my application, I'm using Glaze for JSON and networking. Unfortunately, I'm not getting any data in the Glaze response_body for some target URLs. For testing, I'm using "http://example.com" as the target and the Glaze Basic Usage Example for HTTP Client Networking.

Tested with:
Glaze Version 7.2.1 and 7.2.2
Asio Version 1.36 and 1.38

Tested on OS:
FreeBSD 15.0 and macOS Tahoe 26.2 with g++ and clang++

Clang and G++ Version:
macOS: Apple clang version 17.0.0 (clang-1700.6.3.2)
FreeBSD: g++ 14.2.0
FreeBSD: clang version 19.1.7

Example Code:

#include <iostream>
#include <string>

#include "glaze/net/http_client.hpp"

int main() {

    glz::http_client client;

    auto response = client.get("http://example.com");

    if (response) {
        std::cout << "Status: " << response->status_code << std::endl;
        std::cout << "Body: " << response->response_body << std::endl;

        // Access response headers
        for (const auto& [name, value] : response->response_headers) {
            std::cout << name << ": " << value << std::endl;
        }
    } else {
        std::cerr << "Error: " << response.error().message() << std::endl;
    }

    return 0;
}

Compile:
floyd@MacBookPro tests % clang++ -std=c++23 -I/usr/include -I/usr/local/include/ -I./ test_get.cpp

Start:
floyd@MacBookPro tests % ./a.out

Output:

Status: 200
Body:
cf-ray: 9e46cb1a6fded406-FRA
cf-cache-status: HIT
age: 7240
accept-ranges: bytes
last-modified: Tue, 24 Mar 2026 22:06:31 GMT
allow: GET, HEAD
server: cloudflare
connection: keep-alive
date: Mon, 30 Mar 2026 11:32:22 GMT
transfer-encoding: chunked
content-type: text/html

Wireshark Output:
wireshark

Test with Curl:
floyd@MacBookPro tests % curl -X GET "http://example.com"

Curl Output:
<!doctype html><html lang="en"><head><title>Example Domain</title><meta name="viewport" content="width=device-width, initial-scale=1"><style>body{background:#eee;width:60vw;margin:15vh auto;font-family:system-ui,sans-serif}h1{font-size:1.5em}div{opacity:0.8}a:link,a:visited{color:#348}</style></head><body><div><h1>Example Domain</h1><p>This domain is for use in documentation examples without needing permission. Avoid use in operations.</p><p><a href="https://iana.org/domains/example">Learn more</a></p></div></body></html>

What am I doing wrong? Does anyone have any ideas?
Thank you so much for any help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions