From 67240ae09fd3d601a03ffdb404bbd9875996d43c Mon Sep 17 00:00:00 2001 From: ICHINOSE Shogo Date: Fri, 2 Feb 2024 16:26:31 +0900 Subject: [PATCH] add test for isBinary --- ridgenative_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ridgenative_test.go b/ridgenative_test.go index 787e497..53f7850 100644 --- a/ridgenative_test.go +++ b/ridgenative_test.go @@ -949,3 +949,28 @@ func TestLambdaHandlerStreaming(t *testing.T) { } }) } + +func TestIsBinary(t *testing.T) { + tests := []struct { + contentType string + want bool + }{ + {"text/html", false}, + {"text/plain", false}, + {"text/xml", false}, + {"application/json", false}, + {"application/javascript", false}, + {"application/xml", false}, + {"application/foo+json", false}, + {"application/foo+xml", false}, + {"application/foo+xml ; charset=utf8", false}, + {"application/octet-stream", true}, + } + + for _, tt := range tests { + got := isBinary(tt.contentType) + if got != tt.want { + t.Errorf("isBinary(%q) = %v, want %v", tt.contentType, got, tt.want) + } + } +}