mirror of
https://github.com/coder/coder.git
synced 2026-06-04 05:28:20 +00:00
2294c55bd9
<!-- If you have used AI to produce some or all of this PR, please ensure you have read our [AI Contribution guidelines](https://coder.com/docs/about/contributing/AI_CONTRIBUTING) before submitting. -->
24 lines
434 B
Go
24 lines
434 B
Go
package aibridged_test
|
|
|
|
import (
|
|
"net/http"
|
|
"sync/atomic"
|
|
)
|
|
|
|
var _ http.Handler = &mockAIUpstreamServer{}
|
|
|
|
type mockAIUpstreamServer struct {
|
|
hitCounter atomic.Int32
|
|
}
|
|
|
|
func (m *mockAIUpstreamServer) ServeHTTP(rw http.ResponseWriter, _ *http.Request) {
|
|
m.hitCounter.Add(1)
|
|
|
|
rw.WriteHeader(http.StatusTeapot)
|
|
_, _ = rw.Write([]byte(`i am a teapot`))
|
|
}
|
|
|
|
func (m *mockAIUpstreamServer) Hits() int32 {
|
|
return m.hitCounter.Load()
|
|
}
|