(t *testing.T)
| 316 | } |
| 317 | |
| 318 | func TestIsReplicaRelayRequest(t *testing.T) { |
| 319 | t.Parallel() |
| 320 | |
| 321 | t.Run("WithHeader", func(t *testing.T) { |
| 322 | t.Parallel() |
| 323 | r, _ := http.NewRequestWithContext(context.Background(), "GET", "/api/experimental/chats/abc/stream", nil) |
| 324 | r.Header.Set("X-Coder-Relay-Source-Replica", "some-uuid") |
| 325 | require.True(t, isReplicaRelayRequest(r)) |
| 326 | }) |
| 327 | |
| 328 | t.Run("WithoutHeader", func(t *testing.T) { |
| 329 | t.Parallel() |
| 330 | r, _ := http.NewRequestWithContext(context.Background(), "GET", "/api/experimental/chats/abc/stream", nil) |
| 331 | require.False(t, isReplicaRelayRequest(r)) |
| 332 | }) |
| 333 | |
| 334 | t.Run("EmptyHeader", func(t *testing.T) { |
| 335 | t.Parallel() |
| 336 | r, _ := http.NewRequestWithContext(context.Background(), "GET", "/api/experimental/chats/abc/stream", nil) |
| 337 | r.Header.Set("X-Coder-Relay-Source-Replica", "") |
| 338 | require.False(t, isReplicaRelayRequest(r)) |
| 339 | }) |
| 340 | } |
| 341 | |
| 342 | func TestEscapePostgresURLUserInfo(t *testing.T) { |
| 343 | t.Parallel() |
nothing calls this directly
no test coverage detected