为什么事件中心发布请求包含多种内容类型?

时间:2018-04-05 13:37:57

标签: http-post content-type azure-eventhub

我正在尝试根据此https://docs.microsoft.com/en-us/rest/api/eventhub/generate-sas-token

向事件中心实例发布帖子请求
POST https://<yournamespace>.servicebus.windows.net/<yourentity>/messages
Content-Type: application/json
Authorization: SharedAccessSignature sr=https%3A%2F%2F<yournamespace>.servicebus.windows.net%2F<yourentity>&sig=<yoursignature from code above>&se=1438205742&skn=KeyName
ContentType: application/atom+xml;type=entry;charset=utf-8

它似乎有两个内容类型字段。我对HTTP协议不太熟悉,但据我所知,Content-Type实体头用于指示资源的媒体类型。一个帖子请求可以使用Content-Type: multipart/form-data;包含多种内容类型 使用上述语句Content-Type和ContentType的目的是什么? 为什么https://docs.microsoft.com/en-us/rest/api/eventhub/event-hubs-runtime-rest中的相同帖子请求仅包含内容类型字段?

POST https://your-namespace.servicebus.windows.net/your-event-hub/messages? 
timeout=60&api-version=2014-01 HTTP/1.1  
Authorization: SharedAccessSignature sr=your-namespace.servicebus.windows.net&sig=tYu8qdH563Pc96Lky0SFs5PhbGnljF7mLYQwCZmk9M0%3d&se=1403736877&skn=RootManageSharedAccessKey  
Content-Type: application/atom+xml;type=entry;charset=utf-8  
Host: your-namespace.servicebus.windows.net  
BrokerProperties: {"PartitionKey": "32119834-65f3-48c1-b366-619df2e4c400"}  

{ "DeviceId":"dev-01", "Temperature":"37.0" }    

0 个答案:

没有答案