Commit 66b481587732c7cd87a4574e9fb77e4b917832df
Simplify serveRaw
Charles Lehner committed on 4/15/2016, 6:13:23 PMParent: ebbef91f252638540e837f6a111d16e0c503983b
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -1904,22 +1904,16 @@ | ||
1904 | 1904 | }) |
1905 | 1905 | } |
1906 | 1906 | |
1907 | 1907 | function serveRaw(length, contentType) { |
1908 | - var inBody | |
1909 | 1908 | var headers = { |
1910 | 1909 | 'Content-Type': contentType || 'text/plain; charset=utf-8', |
1911 | 1910 | 'Cache-Control': 'max-age=31536000' |
1912 | 1911 | } |
1913 | 1912 | if (length != null) |
1914 | 1913 | headers['Content-Length'] = length |
1915 | 1914 | return function (read) { |
1916 | - return function (end, cb) { | |
1917 | - if (inBody) return read(end, cb) | |
1918 | - if (end) return cb(true) | |
1919 | - cb(null, [200, headers]) | |
1920 | - inBody = true | |
1921 | - } | |
1915 | + return cat([pull.once([200, headers]), read]) | |
1922 | 1916 | } |
1923 | 1917 | } |
1924 | 1918 | |
1925 | 1919 | function getBlob(req, key, cb) { |
Built with git-ssb-web