MCPcopy
hub / github.com/perkeep/perkeep / TestServeBlobRef_Range

Function TestServeBlobRef_Range

pkg/blobserver/gethandler/get_test.go:66–76  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

64}
65
66func TestServeBlobRef_Range(t *testing.T) {
67 req, _ := http.NewRequest("GET", "/path/isn't/used", nil)
68 req.Header.Set("Range", "bytes=0-2")
69 br := blob.MustParse("foo-000")
70 rr := httptest.NewRecorder()
71 rr.Body = new(bytes.Buffer)
72 ServeBlobRef(rr, req, br, fetcher{strings.NewReader("foobar"), 6})
73 if rr.Body.String() != "foo" {
74 t.Errorf("Got %q; want foo", rr.Body)
75 }
76}
77
78func TestServeBlobRef_Streams(t *testing.T) {
79 var whatWasRead bytes.Buffer

Callers

nothing calls this directly

Calls 5

MustParseFunction · 0.92
ServeBlobRefFunction · 0.85
NewRequestMethod · 0.80
SetMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected