Skip to content

[python] Generated client sets content-type to None for empty body, causing ValueError: No value for given attribute #11253

Description

@xingwu1

Body

Bug description

This appears to be a TypeSpec Python emitter bug, not a service-specific Batch bug.

In a TypeSpec-generated Azure Python SDK, BatchClient.begin_terminate_job() crashes when called with the default value for the optional options parameter, or with a default-constructed BatchJobTerminateOptions.

Actual behavior

Generated code leaves content_type = None when the request body is empty, but still unconditionally serializes the content-type header. This raises:

ValueError: No value for given attribute

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingemitter:client:pythonIssue for the Python client emitter: @typespec/http-client-python

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions