Commit 3cecdbe
Add spector integration test for payload/head HEAD operation response headers (#4789)
HEAD operations with response-header-only return types were generating
`Promise<void>`, making headers inaccessible in the returned value. The
`payload/head` spec from `@typespec/http-specs` exercises this — a HEAD
endpoint returning `Content-Type` and `x-ms-meta` headers.
## Changes
- **`test/commands/spector-list.js`** — Register `payload/head` for
client generation
-
**`test/azure-modular-integration/generated/payload/head/tspconfig.yaml`**
— New tspconfig with `include-headers-in-response: true` to surface
response headers in the return type
-
**`test/azure-modular-integration/generated/payload/head/src/index.d.ts`**
— Generated declarations; `contentTypeHeaderInResponse` now returns
`Promise<{ contentType?: string; metadata?: string }>` instead of
`Promise<void>`
- **`test/azure-modular-integration/payload-head.test.ts`** —
Integration test asserting headers are accessible on the returned object
```typescript
// Before: Promise<void> — headers inaccessible
// After: with include-headers-in-response: true
const result = await client.contentTypeHeaderInResponse();
assert.strictEqual(result.contentType, "text/plain; charset=utf-8");
assert.strictEqual(result.metadata, "hello");
```
The `include-headers-in-response` option is opt-in; this test makes the
per-service tspconfig the natural place to enable it, consistent with
existing usage in the storage data-plane specs.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: v-jiaodi <80496810+v-jiaodi@users.noreply.github.com>1 parent f6e42f0 commit 3cecdbe
6 files changed
Lines changed: 77 additions & 0 deletions
File tree
- .chronus/changes
- packages/typespec-ts/test
- azure-modular-integration
- generated/payload/head
- src
- commands
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
185 | 189 | | |
186 | 190 | | |
187 | 191 | | |
| |||
0 commit comments