diff options
| author | Shulhan <ms@kilabit.info> | 2018-12-16 21:41:28 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2018-12-16 21:41:28 +0700 |
| commit | fc00870ca1e2213f028347672299c12d5f8216ba (patch) | |
| tree | 9c220cf03fa2e8a72e888977f7ad9dd422f37ec8 /lib/http/server_test.go | |
| parent | 6ff04673023fd00d09db48c27e80f462730400dc (diff) | |
| download | pakakeh.go-fc00870ca1e2213f028347672299c12d5f8216ba.tar.xz | |
lib/http: handle large size of file that is not on memory
Diffstat (limited to 'lib/http/server_test.go')
| -rw-r--r-- | lib/http/server_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/http/server_test.go b/lib/http/server_test.go index 9eacb4e2..44b26797 100644 --- a/lib/http/server_test.go +++ b/lib/http/server_test.go @@ -13,6 +13,7 @@ import ( "os" "testing" + "github.com/shuLhan/share/lib/memfs" "github.com/shuLhan/share/lib/test" ) @@ -53,6 +54,9 @@ func TestMain(m *testing.M) { Addr: "127.0.0.1:8080", } + // Testing handleFS with large size. + memfs.MaxFileSize = 30 + testServer, e = NewServer("testdata", conn) if e != nil { log.Fatal(e) @@ -189,6 +193,11 @@ func TestRegisterGet(t *testing.T) { expStatusCode: http.StatusOK, expBody: "<html><body>Hello, world!</body></html>\n", }, { + desc: "With known path", + reqURL: "http://127.0.0.1:8080/index.js", + expStatusCode: http.StatusOK, + expBody: "var a = \"Hello, world!\"\n", + }, { desc: "With known path and subtree root", reqURL: "http://127.0.0.1:8080/get/", expStatusCode: http.StatusNotFound, |
