Skip to content

[http]: Add HEAD operation template that returns resource-related headers #12411

Open

Description

Copied from: Azure/typespec-azure#3976

We recently worked with some HEAD operation definitions and thought that it would be useful to have a type that allows folks to create a HEAD operation based on a GET operation, which would automatically signal that this service also supports HEAD operations for that endpoint and automatically considers all of the headers for that operation so the true definition lives in one place and it's easier to maintain the supported set of headers in one definition.

@get op getBlob(): File;

op listProperties is Head<getBlob>;

Activity

  1. github-actions commented on Oct 27, 2026

    @github-actions
    Contributor

    🎯 Issue Triage

    Requests an HTTP operation template for declaring HEAD support from a corresponding GET operation while reusing its resource-related response headers as the single source of truth.

    Category: Feature Request

    Area: lib:http

    🔍 Analysis

    This affects @typespec/http operation modeling and template design. The key design questions are how the HEAD operation identifies its GET counterpart, which GET response headers are inherited, and how status codes, parameters, and routes are preserved while excluding the response body. #6573 and closed #9809 concern HEAD validation/header handling, but neither requests this reusable GET-derived operation template.

    📝 Suggested next steps
    • Define the template signature and explicit association with the source GET operation.
    • Specify header inheritance across response variants and status codes.
    • Add HTTP metadata and emitter tests confirming that HEAD retains headers but no response body.

    Generated by Agentic Triage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions