[Spector] Add optional successful response body scenario
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 90
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 156
Description
## Scenario
Add an Azure HTTP Spector scenario for an operation whose successful response may either contain a model body or contain no body, while response headers remain meaningful in both cases:
```tsp
op getLayout(): {
@statusCode statusCode: 200;
@header properties: string;
@body layout: BlobLayout;
} | {
@statusCode statusCode: 204;
@header properties: string;
};
```
The scenario should exercise both declared outcomes:
- `200 OK` with headers and a valid `BlobLayout` body.
- `204 No Content` with the same applicable headers and no body.
## Why
Azure SDK emitters need coverage for optional successful response bodies without treating `204` as an error or attempting to deserialize an empty payload. This is distinct from a missing resource (`404`) and from a nullable JSON body.
For .NET Azure.Core-based libraries, the expected convenience shape is `NullableResponse`:
- `200`: `HasValue` is `true` and `Value` contains the layout.
- `204`: `HasValue` is `false`; response status and headers remain accessible through `GetRawResponse()`.
## Validation
The scenario should verify success classification, body handling, and preservation of response headers for both outcomes so Azure emitters can add consistent end-to-end coverage.
Contributor guide
Assessment
This issue has not been assessed yet.