(t *testing.T, req *http.Request, method, url, body string)
| 43 | } |
| 44 | |
| 45 | func 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 | |
| 60 | func getTime(t time.Time) stream.Time { |
| 61 | st, _ := time.Parse(stream.TimeLayout, t.Truncate(time.Second).Format(stream.TimeLayout)) |
no test coverage detected