MCPcopy Create free account
hub / github.com/GetStream/stream-go2 / testRequest

Function testRequest

utils_test.go:45–58  ·  view source on GitHub ↗
(t *testing.T, req *http.Request, method, url, body string)

Source from the content-addressed store, hash-verified

43}
44
45func testRequest(t *testing.T, req *http.Request, method, url, body string) {
46 assert.Equal(t, url, req.URL.String())
47 assert.Equal(t, method, req.Method)
48 if req.Method == http.MethodPost {
49 reqBody, err := io.ReadAll(req.Body)
50 require.NoError(t, err)
51 assert.JSONEq(t, body, string(reqBody))
52 }
53 headers := req.Header
54 if headers.Get("X-API-Key") == "" {
55 assert.NotEmpty(t, headers.Get("Stream-Auth-Type"))
56 assert.NotEmpty(t, headers.Get("Authorization"))
57 }
58}
59
60func getTime(t time.Time) stream.Time {
61 st, _ := time.Parse(stream.TimeLayout, t.Truncate(time.Second).Format(stream.TimeLayout))

Callers 15

TestFlagActivityFunction · 0.85
TestFlagReactionFunction · 0.85
TestFlagUserFunction · 0.85
TestUpdateStatusBatchFunction · 0.85
TestInvalidateUserCacheFunction · 0.85
TestGetCollectionObjectFunction · 0.85

Calls 2

StringMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected