Repository navigation
Report client usage in the User-Agent header, not source - #6
Merged
Merged
Conversation
AI: Claude Opus 5.5 · effort high · serpapi-sdk-developer: ported serpapi-ruby PR #50 (SerpApi#11027) to Zig, ran lint, offline + live suites, oobt, cov, demos and cross builds Every request now sends `User-Agent: serpapi-zig/<version> zig/<zig version> (<os>; <arch>)`, e.g. `serpapi-zig/1.2.0 zig/0.16.0 (macos; aarch64)`, set once in fetchStatus so GET and the Image API POST share it. It replaces std.http's default `zig/0.16.0 (std.http)` and is a comptime constant exported as `serpapi.user_agent`. The client no longer adds `source=serpapi-zig:<version>` to URLs or the image form, matching serpapi-ruby. This also fixes a constructor `.source` being sent next to the library's own (two `source` values). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the Unreleased CHANGELOG and README entries into the 1.2.0 section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements serpapi/SerpApi#11027 for serpapi-zig, following serpapi-ruby PR #50.
Changes
User-Agent: serpapi-zig/<ver> zig/<zig ver> (<os>; <arch>), e.g.serpapi-zig/1.2.0 zig/0.16.0 (macos; aarch64). Previously Zig's defaultzig/0.16.0 (std.http)was sent.source=serpapi-zig:<ver>. This also fixes a duplicatesourcewhen the caller passed their own (same bug as Go/.NET/C++).api_key+ the image.serpapi.user_agentis exported.OS/arch use Zig's names (
macos,x86_64) and are comptime values of the build target.Testing
zig build lint: passzig build test: 45/45 (3 new, including an offline capture test asserting the header on GET and POST)zig build itest: 23/23zig build oobt,doc, demos: passserpapi.com does not echo the User-Agent or
source, so the header is verified offline only; live tests confirm the backend accepts it.Open questions
sourceand describe the runtime/platform suffix.Stacked on #5 (
prepare-1.2.0).🤖 Generated with Claude Code