Skip to content

Commit

Permalink
Fix Content-Type header of application/xop+xml root part.
Browse files Browse the repository at this point in the history
  • Loading branch information
janno-p committed Nov 30, 2016
1 parent 2693a1c commit 8df4563
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 1.0.0-beta040 - 30.11.2016
* Fix Content-Type header value of `application/xop+xml` message root part.

#### 1.0.0-beta039 - 29.11.2016
* Extension package to support Google Protocol Buffers serialization.

Expand Down
5 changes: 4 additions & 1 deletion src/XRoadLib/Serialization/XRoadMessageWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ namespace XRoadLib.Serialization
internal class XRoadMessageWriter : IDisposable
{
public const string NEW_LINE = "\r\n";

private const string SOAP_MULTIPART_ROOT_CONTENT_TYPE = "Content-Type: text/xml; charset=UTF-8";
private const string XOP_MULTIPART_ROOT_CONTENT_TYPE = "Content-Type: " + XRoadMessage.MULTIPART_CONTENT_TYPE_XOP + @"; charset=UTF-8; type=""text/xml""";

private readonly CountingStream outputStream;

Expand Down Expand Up @@ -78,7 +81,7 @@ private void SerializeMessage(XRoadMessage source, string contentID, string boun
writer.Write(NEW_LINE);
writer.Write("--{0}", boundaryMarker);
writer.Write(NEW_LINE);
writer.Write("Content-Type: text/xml; charset=UTF-8");
writer.Write(source.BinaryMode == BinaryMode.Attachment ? SOAP_MULTIPART_ROOT_CONTENT_TYPE : XOP_MULTIPART_ROOT_CONTENT_TYPE);
writer.Write(NEW_LINE);
writer.Write("Content-Transfer-Encoding: 8bit");
writer.Write(NEW_LINE);
Expand Down
2 changes: 1 addition & 1 deletion test/XRoadLib.Tests/Serialization/XRoadMessageTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void CanWriteContentWithAttachments()
using (var y = new XRoadAttachment(new MemoryStream(new byte[] { 5, 6, 7, 8, 9 })))
{
var contentLength = WriteContent("test2", new[] { x, y });
Assert.Equal(534L, contentLength);
Assert.Equal(562L, contentLength);
}
}

Expand Down

0 comments on commit 8df4563

Please sign in to comment.