Skip to content

DurableOrchestrationContext call_http does not work with string inputΒ #473

@nickholt15

Description

@nickholt15

πŸ› Describe the bug

There is a logical error in the DurableOrchestrationContext call_http method.

https://github.com/Azure/azure-functions-durable-python/blob/dev/azure/durable_functions/models/DurableOrchestrationContext.py#L215

content is type hinted as a str, however it only works with dictionary input.

I noticed this error when turning on type checking within VS Code.

To satisfy the type checker, I tried piping the dictionary object through json.dumps(), but that led to an error during execution.

πŸ€” Expected behavior
This should work with either dictionary or string input. It only works with dictionary input.

β˜• Steps to reproduce
Construct an arbitrary payload with key-value pairs.

context.call_http(method='POST', content=payload, uri=my_uri) succeeds

context.call_http(method='POST', content=json.dumps(payload), uri=my_uri) fails

Line 239 is responsible for the error: https://github.com/Azure/azure-functions-durable-python/blob/dev/azure/durable_functions/models/DurableOrchestrationContext.py#L239

The line:

if content and content is not isinstance(content, str):

should instead be:

if content and not isinstance(content, str):

Metadata

Metadata

Assignees

Labels

P1Priority 1bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions