MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / TestHTTPClient_NilResult

Function TestHTTPClient_NilResult

pkg/api/http_test.go:549–563  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

547}
548
549func TestHTTPClient_NilResult(t *testing.T) {
550 server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
551 response := map[string]interface{}{"success": true}
552
553 w.Header().Set("Content-Type", "application/json")
554 _ = json.NewEncoder(w).Encode(response)
555 }))
556 defer server.Close()
557
558 client := NewHTTPClient(server.Client(), server.URL, testutils.NewTestLogger())
559
560 // Test with nil result - should not error
561 err := client.Get(context.Background(), "/test", nil)
562 require.NoError(t, err)
563}
564
565func TestHTTPClient_EmptyResponse(t *testing.T) {
566 server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 7

GetMethod · 0.95
NewTestLoggerFunction · 0.92
NewHTTPClientFunction · 0.85
HeaderMethod · 0.80
ClientMethod · 0.80
SetMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected