MCPcopy Index your code
hub / github.com/coder/coder / assertWebpushPayload

Function assertWebpushPayload

coderd/webpush/webpush_test.go:511–521  ·  view source on GitHub ↗
(t testing.TB, r *http.Request)

Source from the content-addressed store, hash-verified

509}
510
511func assertWebpushPayload(t testing.TB, r *http.Request) {
512 t.Helper()
513 assert.Equal(t, http.MethodPost, r.Method)
514 assert.Equal(t, "application/octet-stream", r.Header.Get("Content-Type"))
515 assert.Equal(t, r.Header.Get("content-encoding"), "aes128gcm")
516 assert.Contains(t, r.Header.Get("Authorization"), "vapid")
517
518 // Attempting to decode the request body as JSON should fail as it is
519 // encrypted.
520 assert.Error(t, json.NewDecoder(r.Body).Decode(io.Discard))
521}
522
523// setupPushTest creates a common test setup for webpush notification tests.
524// The test HTTP client bypasses SSRF protection so that httptest.Server

Callers 1

TestPushFunction · 0.85

Calls 5

HelperMethod · 0.65
GetMethod · 0.65
EqualMethod · 0.45
ContainsMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected