Skip to content

[http-client-java] Continue after constant response headers - #11793

Merged
Weidong Xu (weidongxu-microsoft) merged 1 commit into
microsoft:mainfrom
weidongxu-microsoft:fix/java-response-constant-header
Aug 31, 2026
Merged

[http-client-java] Continue after constant response headers#11793
Weidong Xu (weidongxu-microsoft) merged 1 commit into
microsoft:mainfrom
weidongxu-microsoft:fix/java-response-constant-header

Conversation

@weidongxu-microsoft

Copy link
Copy Markdown
Contributor

Summary

  • continue processing response headers after omitting a constant header
  • suppress the constant-header warning only for Content-Type
  • add a response-header generation regression case

Validation

  • npm run build
  • npm run format
  • pnpm format
  • pnpm exec oxlint packages/http-client-java/emitter --type-aware --deny-warnings
  • npm run test:emitter
  • mvn test --define "test=tsptest.responseheaders.ResponseHeadersTests" --no-transfer-progress

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bb07cf76-b69f-4640-87a7-8660a97e0d23
@github-actions

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • @typespec/http-client-java
Show changes

@typespec/http-client-java - fix ✏️

Continue generating response headers that follow a constant header.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the Java emitter’s response-header collection logic so that encountering a constant response header no longer stops processing subsequent headers, while also limiting the “constant header removed” warning suppression to Content-Type. It also extends the existing response-headers TypeSpec test input to include a constant response header as a regression case.

Changes:

  • Continue iterating through response headers after omitting a constant header (use continue instead of exiting the loop).
  • Emit the constant-header-in-response-removed warning for constant response headers except Content-Type.
  • Add a constant response header to the response-headers generator test scenario, plus a Chronus fix entry.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/http-client-java/generator/http-client-generator-test/tsp/response-headers.tsp Adds a constant response header to validate it’s omitted without affecting subsequent generated headers.
packages/http-client-java/emitter/src/code-model-builder.ts Fixes response header processing to skip constant headers but keep processing the rest; suppresses warning only for Content-Type.
.chronus/changes/fix-java-response-constant-header-2026-08-31.md Adds changelog entry describing the fix for constant response headers.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@azure-sdk-automation

azure-sdk-automation Bot commented Aug 31, 2026

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Merged via the queue into microsoft:main with commit 5b9cd21 Aug 31, 2026
35 checks passed
@weidongxu-microsoft
Weidong Xu (weidongxu-microsoft) deleted the fix/java-response-constant-header branch August 31, 2026 07:27
Weidong Xu (weidongxu-microsoft) added a commit to Azure/typespec-azure that referenced this pull request Aug 31, 2026
## Summary

- bump `@azure-tools/typespec-java` from `0.46.0` to `0.46.1`
- publish the Java fixes synced in #5239

## Included fixes

- management `remove-model` generation (`microsoft/typespec#11698`)
- Javadocs containing `*/` (`microsoft/typespec#11766`)
- response headers following a constant header
(`microsoft/typespec#11793`)

---------

Copilot-Session: 0c853adf-d456-4d99-bacc-fd941aca7924
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:java Issue for the Java client emitter: @typespec/http-client-java

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants