microsoft / microsoft/typespec
`@head` request with a body wrongly flags the content type
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
Release 1.9.1 of `@typespec/http` updated so that the content-type header present in
[Playground Link](https://typespec.io/playground/?e=%40typespec%2Fopenapi3&c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7Cgp1c2luZyBIdHRwOwoKQGhlYWQKb3AgbGlzdEhlYWQoKTogT2tSZXNwb25zZSB8IEVycm9yxCplxAkKbW9kZWzGFSB7CiAgxUFlcgogIGNvbnRlbnRUeXBlOiAiYXBwbGljYXRpb24vcHJvYmxlbStqc29u5ACCICDkAJU6IHN0cmluZzsKfQo%3D&options=%7B%7D&vs=%7B%7D)
I don't know if it is valid or not to do that with HEAD but the resulting openapi seems wrong as it now include the content type as header and the response has the wrong one
```tsp
import "@typespec/http";
using Http;
@head
op listHead(): OkResponse | Error;
@error
model Error {
@header
contentType: "application/problem+json";
type: string;
}
```
```yaml
headers:
content-type:
required: true
schema:
type: string
enum:
- application/problem+json
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
```
Contributor guide
Assessment
This issue has not been assessed yet.