Sample code for 30+ languages & platforms
Zig

Example: Http.RemoveRequestHeader method

Demonstrates how to call the RemoveRequestHeader method.

Also see: Chilkat Http Default and Auto-Filled Headers

Chilkat Zig Downloads

Zig
const std = @import("std");
const chilkat = @import("chilkat");

pub fn main(init: std.process.Init) !void {
    const alloc = init.arena.allocator();

    const http = try chilkat.Http.init();
    defer http.deinit();

    // Add a request header.
    http.setRequestHeader("X-Something", "1234");

    var response_body: [:0]const u8 = try http.quickGetStr(alloc, "https://chilkatsoft.com/helloWorld.txt");
    // Examine the request header we just sent..
    std.debug.print("{s}\n", .{try http.getLastHeader(alloc)});
    std.debug.print("----\n", .{});

    // Output:

    // GET /helloWorld.txt HTTP/1.1
    // Host: chilkatsoft.com
    // Accept: */*
    // Accept-Encoding: gzip
    // X-Something: 1234

    // Remove the request header we previously added:
    http.removeRequestHeader("X-Something");

    response_body = try http.quickGetStr(alloc, "https://chilkatsoft.com/helloWorld.txt");
    std.debug.print("{s}\n", .{try http.getLastHeader(alloc)});

    // Output:

    // GET /helloWorld.txt HTTP/1.1
    // Host: chilkatsoft.com
    // Accept: */*
    // Accept-Encoding: gzip
}