azure-functions-python-worker icon indicating copy to clipboard operation
azure-functions-python-worker copied to clipboard

[FeatureRequest] type serviceBus direction out - specify content-type

Open freedev opened this issue 3 years ago • 1 comments

It seems not possible define the content-type for an out message. In my function.json I have an out serviceBus that works fine but I'm unable to define the content-type.

{
  "type": "serviceBus",
  "direction": "out",
  "connection": "AzureServiceBusConnectionString",
  "name": "outmsg",
  "topicName": "%DIGICD_NOTIFICATION%"
}

but outmsg is defined as azure.functions.Out[str]. Honestly, I'm not fluent in Python, It seems to me that Out is a monad, an object that contains a string. it is not clear if we can define Out with another type other than str. And in any case even if the message is sent as str with content-type for the receiver is application/xml; charset=utf-8

I think we should be able at least to specify the content type. Something like this:

outmsg.set(json.dumps({ 'key':'value' })) 
outmsg.setContentType('application/json') 

Or we could extend the function.json adding the default content type parameter of out messages.

freedev avatar Jul 28 '21 15:07 freedev

any update here?

freedev avatar Jan 11 '22 16:01 freedev