MCPcopy Index your code
hub / github.com/cortexproject/cortex / createRequest

Function createRequest

pkg/util/push/push_test.go:1153–1170  ·  view source on GitHub ↗
(t *testing.T, protobuf []byte, isV2 bool)

Source from the content-addressed store, hash-verified

1151}
1152
1153func createRequest(t *testing.T, protobuf []byte, isV2 bool) *http.Request {
1154 t.Helper()
1155 inoutBytes := snappy.Encode(nil, protobuf)
1156 req, err := http.NewRequest("POST", "http://localhost/", bytes.NewReader(inoutBytes))
1157 require.NoError(t, err)
1158
1159 req.Header.Add("Content-Encoding", "snappy")
1160
1161 if isV2 {
1162 req.Header.Set("Content-Type", appProtoV2ContentType)
1163 req.Header.Set("X-Prometheus-Remote-Write-Version", remoteWriteVersion20HeaderValue)
1164 return req
1165 }
1166
1167 req.Header.Set("Content-Type", appProtoContentType)
1168 req.Header.Set("X-Prometheus-Remote-Write-Version", remoteWriteVersion1HeaderValue)
1169 return req
1170}
1171
1172func createCortexRemoteWriteV2Protobuf(t *testing.T, skipLabelNameValidation bool, source cortexpb.SourceEnum) []byte {
1173 t.Helper()

Calls 3

EncodeMethod · 0.65
SetMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected