diff options
| author | Shulhan <ms@kilabit.info> | 2023-03-11 20:16:59 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-03-12 11:37:17 +0700 |
| commit | 7d4c26cef490689eb5817c17e102d1e7128c682e (patch) | |
| tree | b69ea23471932b0a8054bb1a371f8b21a156361c /lib/http/testdata/range | |
| parent | 8e2fa2b18662da4e42bc2be5f20103dd5e2cb8f8 (diff) | |
| download | pakakeh.go-7d4c26cef490689eb5817c17e102d1e7128c682e.tar.xz | |
lib/http: add function to parse multipart Range response for Client
The ParseMultipartRange parse the multipart/byteranges body or response
from HTTP Range request.
Each Content-Range position and body part in the multipart will be stored
under RangePosition.
Diffstat (limited to 'lib/http/testdata/range')
| -rw-r--r-- | lib/http/testdata/range/invalid_boundary_test.txt | 16 | ||||
| -rw-r--r-- | lib/http/testdata/range/missing_last_boundary_test.txt | 12 | ||||
| -rw-r--r-- | lib/http/testdata/range/ok_test.txt | 19 |
3 files changed, 47 insertions, 0 deletions
diff --git a/lib/http/testdata/range/invalid_boundary_test.txt b/lib/http/testdata/range/invalid_boundary_test.txt new file mode 100644 index 00000000..7fa7fdbb --- /dev/null +++ b/lib/http/testdata/range/invalid_boundary_test.txt @@ -0,0 +1,16 @@ +>>> body +--zxcv +Content-Range: bytes 0-6/50 + + +--zxcv -- +Content-Range: bytes 0-6/50 + + + +<<< error +ParseMultipartRange: on NextPart: multipart: expecting a new Part; got line "--zxcv --\r\n" + +<<< expected + +<<< END diff --git a/lib/http/testdata/range/missing_last_boundary_test.txt b/lib/http/testdata/range/missing_last_boundary_test.txt new file mode 100644 index 00000000..8388f517 --- /dev/null +++ b/lib/http/testdata/range/missing_last_boundary_test.txt @@ -0,0 +1,12 @@ +>>> body +--zxcv +Content-Range: bytes 10-15/50 + +Part 1 + +<<< error +ParseMultipartRange: on ReadAll part: unexpected EOF + +<<< expected + +<<< END diff --git a/lib/http/testdata/range/ok_test.txt b/lib/http/testdata/range/ok_test.txt new file mode 100644 index 00000000..3e1f22d9 --- /dev/null +++ b/lib/http/testdata/range/ok_test.txt @@ -0,0 +1,19 @@ +>>> body +--zxcv +Content-Range: bytes 10-15/50 + +Part 1 +--zxcv +Content-Range: bytes 20-25/50 + +Part 2 +--zxcv-- + +<<< error + +<<< expected +10-15: Part 1 +20-25: Part 2 + + +<<< END |
