Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/util/push/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func Handler(remoteWrite2Enabled bool, maxRecvMsgSize int, sourceIPs *middleware
http.Error(w, string(resp.Body), int(resp.Code))
} else {
setPRW2RespHeader(w, resp.Samples, resp.Histograms, resp.Exemplars)
w.WriteHeader(http.StatusNoContent)
}
}

Expand Down
10 changes: 5 additions & 5 deletions pkg/util/push/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func TestHandler_remoteWrite(t *testing.T) {
req := createRequest(t, createPrometheusRemoteWriteV2Protobuf(t), true)
resp := httptest.NewRecorder()
handler.ServeHTTP(resp, req)
assert.Equal(t, http.StatusOK, resp.Code)
assert.Equal(t, http.StatusNoContent, resp.Code)

// test header value
respHeader := resp.Header()
Expand All @@ -258,7 +258,7 @@ func TestHandler_ContentTypeAndEncoding(t *testing.T) {
"Content-Encoding": "snappy",
remoteWriteVersionHeader: "2.0.0",
},
expectedCode: http.StatusOK,
expectedCode: http.StatusNoContent,
isV2: true,
},
{
Expand Down Expand Up @@ -321,7 +321,7 @@ func TestHandler_ContentTypeAndEncoding(t *testing.T) {
"Content-Type": appProtoV2ContentType,
remoteWriteVersionHeader: "2.0.0",
},
expectedCode: http.StatusOK,
expectedCode: http.StatusNoContent,
isV2: true,
},
{
Expand All @@ -330,7 +330,7 @@ func TestHandler_ContentTypeAndEncoding(t *testing.T) {
"Content-Type": appProtoV2ContentType,
"Content-Encoding": "snappy",
},
expectedCode: http.StatusOK,
expectedCode: http.StatusNoContent,
isV2: true,
},
{
Expand Down Expand Up @@ -375,7 +375,7 @@ func TestHandler_cortexWriteRequest(t *testing.T) {
req := createRequest(t, createCortexRemoteWriteV2Protobuf(t, false, cortexpb.API), true)
resp := httptest.NewRecorder()
handler.ServeHTTP(resp, req)
assert.Equal(t, 200, resp.Code)
assert.Equal(t, http.StatusNoContent, resp.Code)
})
}

Expand Down
Loading