public void ReadFileNameFromUrlWithoutEndingAndMimeType() { var response = new DefaultResponse { Address = Url.Create("http://example.com/foo"), Headers = new Dictionary <string, string> { } }; var file = response.GetAttachedFileName(); Assert.AreEqual("foo.a", file); }
public void ReadFileNameFromContentDisposition() { var response = new DefaultResponse { Address = Url.Create("http://example.com/foo.png"), Headers = new Dictionary <string, string> { { HeaderNames.ContentDisposition, "attachment; filename=\"filename.jpg\"" }, } }; var file = response.GetAttachedFileName(); Assert.AreEqual("filename.jpg", file); }
public void ReadFileNameFromUrlWithoutEndingButWithMimeType() { var response = new DefaultResponse { Address = Url.Create("http://example.com/foo"), Headers = new Dictionary <string, string> { { HeaderNames.ContentType, "audio/mpeg3" }, } }; var file = response.GetAttachedFileName(); Assert.AreEqual("foo.mp3", file); }