Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@typespec/http-client-java"
---

Continue generating response headers that follow a constant header.
6 changes: 3 additions & 3 deletions packages/http-client-java/emitter/src/code-model-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2322,15 +2322,15 @@ export class CodeModelBuilder {

if (schema instanceof ConstantSchema) {
// skip constant header in response
if (isContentTypeHeader(header)) {
// we does not warn on content-type as constant, as this is the most common case
if (!isContentTypeHeader(header)) {
// we do not warn on content-type as constant, as this is the most common case
reportDiagnostic(this.program, {
code: "constant-header-in-response-removed",
format: { headerName: header.serializedName },
target: header.__raw ?? NoTarget,
});
}
break;
continue;
}

const httpHeader = new HttpHeader(header.serializedName, schema, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ interface ResponseHeaderOp {
getResourceMetadata(): {
@statusCode statusCode: 200;

// constant headers are omitted from the generated response headers model
@header("x-constant-header") constantHeader: "constant-value";

// required header, with mixed-case header name
@header("ETag") eTag: string;

Expand Down