From 523edc467045ad7ebf9e1ccdfe3b7be8d139c441 Mon Sep 17 00:00:00 2001 From: BountyGrid Date: Thu, 10 Sep 2026 03:13:39 -0700 Subject: [PATCH] test(httputilz): add CORS Origin and preflight header preservation specs --- common/httputilz/day3_w13_cors_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 common/httputilz/day3_w13_cors_test.go diff --git a/common/httputilz/day3_w13_cors_test.go b/common/httputilz/day3_w13_cors_test.go new file mode 100644 index 000000000..6dc1e3694 --- /dev/null +++ b/common/httputilz/day3_w13_cors_test.go @@ -0,0 +1,15 @@ +package httputilz + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestParseRequestWithOriginHeader(t *testing.T) { + raw := "OPTIONS /graphql HTTP/1.1\r\nHost: api.example.com\r\nOrigin: https://dashboard.example.com\r\nAccess-Control-Request-Method: POST\r\n\r\n" + req, err := ParseRequest(raw, false) + require.Nil(t, err) + require.NotNil(t, req) + require.Equal(t, "OPTIONS", req.Method) +}