From 0ea92b7280f539d36d1c2ada2f10f50774b2ffb6 Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Mon, 19 Sep 2022 13:52:14 +0800 Subject: [PATCH] chore: add more tests (#2410) --- gateway/internal/requestparser_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gateway/internal/requestparser_test.go b/gateway/internal/requestparser_test.go index ede871f0..c910d02a 100644 --- a/gateway/internal/requestparser_test.go +++ b/gateway/internal/requestparser_test.go @@ -53,3 +53,16 @@ func TestNewRequestParserWithForm(t *testing.T) { assert.Nil(t, err) assert.NotNil(t, parser) } + +func TestNewRequestParserWithBadForm(t *testing.T) { + req := httptest.NewRequest("GET", "/val?a%1=b", nil) + parser, err := NewRequestParser(req, nil) + assert.NotNil(t, err) + assert.Nil(t, parser) +} + +func TestRequestParser_buildJsonRequestParser(t *testing.T) { + parser, err := buildJsonRequestParser(map[string]interface{}{"a": make(chan int)}, nil) + assert.NotNil(t, err) + assert.Nil(t, parser) +}