コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }