Skip to content

Commit ff16041

Browse files
trejjamzidad
authored andcommitted
Do not send empty header (incompatible with RabbitMq.Client)
1 parent 04ab08a commit ff16041

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

Source/EasyNetQ/MessageProperties.cs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,21 @@ public void CopyTo(IBasicProperties basicProperties)
5454
{
5555
Preconditions.CheckNotNull(basicProperties, "basicProperties");
5656

57-
if(contentTypePresent) basicProperties.ContentType = ContentType;
58-
if(contentEncodingPresent) basicProperties.ContentEncoding = ContentEncoding;
59-
if(deliveryModePresent) basicProperties.DeliveryMode = DeliveryMode;
60-
if(priorityPresent) basicProperties.Priority = Priority;
61-
if(correlationIdPresent) basicProperties.CorrelationId = CorrelationId;
62-
if(replyToPresent) basicProperties.ReplyTo = ReplyTo;
63-
if(expirationPresent) basicProperties.Expiration = Expiration;
64-
if(messageIdPresent) basicProperties.MessageId = MessageId;
65-
if(timestampPresent) basicProperties.Timestamp = new AmqpTimestamp(Timestamp);
66-
if(typePresent) basicProperties.Type = Type;
67-
if(userIdPresent) basicProperties.UserId = UserId;
68-
if(appIdPresent) basicProperties.AppId = AppId;
57+
if(contentTypePresent) basicProperties.ContentType = ContentType;
58+
if(contentEncodingPresent) basicProperties.ContentEncoding = ContentEncoding;
59+
if(deliveryModePresent) basicProperties.DeliveryMode = DeliveryMode;
60+
if(priorityPresent) basicProperties.Priority = Priority;
61+
if(correlationIdPresent) basicProperties.CorrelationId = CorrelationId;
62+
if(replyToPresent) basicProperties.ReplyTo = ReplyTo;
63+
if(expirationPresent) basicProperties.Expiration = Expiration;
64+
if(messageIdPresent) basicProperties.MessageId = MessageId;
65+
if(timestampPresent) basicProperties.Timestamp = new AmqpTimestamp(Timestamp);
66+
if(typePresent) basicProperties.Type = Type;
67+
if(userIdPresent) basicProperties.UserId = UserId;
68+
if(appIdPresent) basicProperties.AppId = AppId;
6969
if(clusterIdPresent) basicProperties.ClusterId = ClusterId;
7070

71-
if (headersPresent)
71+
if (headersPresent && Headers.Any())
7272
{
7373
basicProperties.Headers = new Dictionary<string, object>(Headers);
7474
}
@@ -91,7 +91,7 @@ public object Clone()
9191
if (appIdPresent) copy.AppId = AppId;
9292
if (clusterIdPresent) copy.ClusterId = ClusterId;
9393

94-
if (headersPresent)
94+
if (headersPresent && Headers.Any())
9595
{
9696
copy.Headers = new Dictionary<string, object>(Headers);
9797
}
@@ -117,7 +117,7 @@ public object Clone()
117117
private string contentType;
118118

119119
/// <summary>
120-
/// MIME Content type
120+
/// MIME Content type
121121
/// </summary>
122122
public string ContentType
123123
{
@@ -128,7 +128,7 @@ public string ContentType
128128
private string contentEncoding;
129129

130130
/// <summary>
131-
/// MIME content encoding
131+
/// MIME content encoding
132132
/// </summary>
133133
public string ContentEncoding
134134
{
@@ -139,7 +139,7 @@ public string ContentEncoding
139139
private IDictionary<string, object> headers;
140140

141141
/// <summary>
142-
/// message header field table
142+
/// message header field table
143143
/// </summary>
144144
public IDictionary<string, object> Headers
145145
{
@@ -150,7 +150,7 @@ public IDictionary<string, object> Headers
150150
private byte deliveryMode;
151151

152152
/// <summary>
153-
/// non-persistent (1) or persistent (2)
153+
/// non-persistent (1) or persistent (2)
154154
/// </summary>
155155
public byte DeliveryMode
156156
{
@@ -161,7 +161,7 @@ public byte DeliveryMode
161161
private byte priority;
162162

163163
/// <summary>
164-
/// message priority, 0 to 9
164+
/// message priority, 0 to 9
165165
/// </summary>
166166
public byte Priority
167167
{
@@ -172,7 +172,7 @@ public byte Priority
172172
private string correlationId;
173173

174174
/// <summary>
175-
/// application correlation identifier
175+
/// application correlation identifier
176176
/// </summary>
177177
public string CorrelationId
178178
{
@@ -183,7 +183,7 @@ public string CorrelationId
183183
private string replyTo;
184184

185185
/// <summary>
186-
/// destination to reply to
186+
/// destination to reply to
187187
/// </summary>
188188
public string ReplyTo
189189
{
@@ -194,7 +194,7 @@ public string ReplyTo
194194
private string expiration;
195195

196196
/// <summary>
197-
/// message expiration specification
197+
/// message expiration specification
198198
/// </summary>
199199
public string Expiration
200200
{
@@ -205,7 +205,7 @@ public string Expiration
205205
private string messageId;
206206

207207
/// <summary>
208-
/// application message identifier
208+
/// application message identifier
209209
/// </summary>
210210
public string MessageId
211211
{
@@ -216,7 +216,7 @@ public string MessageId
216216
private long timestamp;
217217

218218
/// <summary>
219-
/// message timestamp
219+
/// message timestamp
220220
/// </summary>
221221
public long Timestamp
222222
{
@@ -227,7 +227,7 @@ public long Timestamp
227227
private string type;
228228

229229
/// <summary>
230-
/// message type name
230+
/// message type name
231231
/// </summary>
232232
public string Type
233233
{
@@ -238,7 +238,7 @@ public string Type
238238
private string userId;
239239

240240
/// <summary>
241-
/// creating user id
241+
/// creating user id
242242
/// </summary>
243243
public string UserId
244244
{
@@ -249,7 +249,7 @@ public string UserId
249249
private string appId;
250250

251251
/// <summary>
252-
/// creating application id
252+
/// creating application id
253253
/// </summary>
254254
public string AppId
255255
{
@@ -260,7 +260,7 @@ public string AppId
260260
private string clusterId;
261261

262262
/// <summary>
263-
/// intra-cluster routing identifier
263+
/// intra-cluster routing identifier
264264
/// </summary>
265265
public string ClusterId
266266
{
@@ -390,4 +390,4 @@ private static string CheckShortString(string input, string name)
390390
return input;
391391
}
392392
}
393-
}
393+
}

0 commit comments

Comments
 (0)