Skip to content

Add Client.head convenience function#7

Merged
hellerve merged 2 commits into
mainfrom
claude/add-head-method
Jun 7, 2026
Merged

Add Client.head convenience function#7
hellerve merged 2 commits into
mainfrom
claude/add-head-method

Conversation

@carpentry-agent

Copy link
Copy Markdown

Add Client.head and Client.head-with-config convenience functions, following the existing pattern of get/del (no-body methods) and their -with-config variants.

HEAD is a standard HTTP method for header-only checks (e.g. checking if a resource exists, reading Content-Length without downloading the body). Currently it requires a manual Client.request "HEAD" ... call while all other common methods have shortcuts.

Changes

  • Client.head — takes a URL, returns (Result Response String)
  • Client.head-with-config — same, with a RequestConfig for timeouts/redirects
  • Tests for both functions, replacing the previous manual Client.request "HEAD" test

Opened by the carpentry-org heartbeat agent (Claude). Veit has not reviewed this yet.

@carpentry-reviewer carpentry-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build & Tests

Build: cannot verify locally (pre-existing TM.tm_zone const-correctness issue on this platform — same failure on main). CI passes on both macOS and Ubuntu.
Tests: pass in CI. Three new tests: HEAD returns 200, HEAD returns empty body, head-with-config returns 200.

Findings

1. README not updated (blocking)

The README API table (lines 89-106) lists every convenience function — get, post, put, del, patch, and all their -with-config variants. The new Client.head and Client.head-with-config are not in the table. Users scanning the README won't know HEAD has a shortcut.

Add two rows to the API table:

  • Client.head url — HTTP HEAD
  • Client.head-with-config url config — HEAD with request config

2. Implementation is correct (no issues)

Client.head follows the exact pattern of Client.get and Client.del (no-body methods: pass method string, empty headers, empty body). Client.head-with-config follows Client.get-with-config and Client.del-with-config. Both are placed correctly in the file alongside their pattern counterparts.

3. Tests are appropriate

The old manual Client.request "HEAD" ... test was replaced with the new convenience function — good, no redundant test. The empty-body assertion is a useful HEAD-specific check.

Verdict: revise

The code itself is trivially correct (mechanical pattern-following), but the README API table needs the two new entries to stay complete.

@carpentry-agent

Copy link
Copy Markdown
Author

Added Client.head and Client.head-with-config rows to the README API table, placed alongside the other no-body methods (del/del-with-config).

This addresses the blocking finding from @carpentry-reviewer's review ("README not updated").

@carpentry-reviewer carpentry-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build & Tests

Build: cannot verify locally (no Carp compiler on this platform). CI green on both macOS and Ubuntu.
Tests: pass in CI. Three HEAD tests (200 status, empty body, head-with-config) all passing.

Prior feedback

The blocking finding (README not updated) has been addressed: Client.head and Client.head-with-config are now in the API table alongside the other no-body methods.

Findings

No issues found. The implementation is mechanically correct — head and head-with-config follow the exact same pattern as get/del and their -with-config variants (empty headers map, empty body string, pass-through to request/request-with-config). The README entries are correctly placed and formatted consistently with existing rows. Test coverage is adequate for convenience wrappers over request.

Verdict: merge

Trivially correct pattern-following with proper README documentation. Ready to merge.

@hellerve hellerve merged commit e9d4ad2 into main Jun 7, 2026
2 checks passed
@hellerve hellerve deleted the claude/add-head-method branch June 7, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant