private NameValueCollection GetHeadersFromMessage(RestMSMessage messageSpecification) { var headers = new NameValueCollection(); if (messageSpecification.Headers != null) messageSpecification.Headers.Each(header => headers.Add(header.Name, header.Value)); return headers; }
public HttpResponseMessage PostMessageToFeed(string name, RestMSMessage messageSpecification) { var addMessageToFeedCommand = new AddMessageToFeedCommand( name, messageSpecification.Address, messageSpecification.ReplyTo ?? "", GetHeadersFromMessage(messageSpecification), GetAttachmentFromMessage(messageSpecification.Content) ); _commandProcessor.Send(addMessageToFeedCommand); var item = new RestMSMessagePosted() { Count = addMessageToFeedCommand.MatchingJoins }; return Request.CreateResponse<RestMSMessagePosted>(HttpStatusCode.OK, item); }