File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ func TestPush(t *testing.T) {
33
33
lastPath string
34
34
)
35
35
36
- // Fake a Pushgateway that always responds with 202.
36
+ // Fake a Pushgateway that responds with 202 to DELETE and with 200 in
37
+ // all other cases.
37
38
pgwOK := httptest .NewServer (
38
39
http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
39
40
lastMethod = r .Method
@@ -44,7 +45,11 @@ func TestPush(t *testing.T) {
44
45
}
45
46
lastPath = r .URL .EscapedPath ()
46
47
w .Header ().Set ("Content-Type" , `text/plain; charset=utf-8` )
47
- w .WriteHeader (http .StatusAccepted )
48
+ if r .Method == http .MethodDelete {
49
+ w .WriteHeader (http .StatusAccepted )
50
+ return
51
+ }
52
+ w .WriteHeader (http .StatusOK )
48
53
}),
49
54
)
50
55
defer pgwOK .Close ()
You can’t perform that action at this time.
0 commit comments