Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 22 for wantBody (0.17 sec)

  1. pilot/pkg/request/command_test.go

    	wantMethod string
    	wantPath   string
    	wantBody   []byte
    	StatusCode int
    	Response   string
    }
    
    func (p *pilotStubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
    	p.Lock()
    	if r.Method == p.States[0].wantMethod {
    		if r.URL.Path == p.States[0].wantPath {
    			defer r.Body.Close()
    			body, _ := io.ReadAll(r.Body)
    			if err := util.Compare(body, p.States[0].wantBody); err == nil {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Dec 11 19:11:01 UTC 2023
    - 4.1K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers_test.go

    		statusCode int
    		object     runtime.Object
    
    		wantCode    int
    		wantHeaders http.Header
    		wantBody    []byte
    	}{
    		{
    			name:        "serialize object",
    			out:         smallPayload,
    			req:         &http.Request{Header: http.Header{}, URL: &url.URL{Path: "/path"}},
    			wantCode:    http.StatusOK,
    			wantHeaders: http.Header{"Content-Type": []string{""}},
    			wantBody:    smallPayload,
    		},
    
    		{
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 24 18:25:29 UTC 2024
    - 15.7K bytes
    - Viewed (0)
  3. src/net/http/httptest/httptest_test.go

    			slurp, err := io.ReadAll(got.Body)
    			if err != nil {
    				t.Errorf("ReadAll: %v", err)
    			}
    			if string(slurp) != tt.wantBody {
    				t.Errorf("Body = %q; want %q", slurp, tt.wantBody)
    			}
    			tt.want = tt.want.WithContext(context.Background())
    			got.Body = nil // before DeepEqual
    			if !reflect.DeepEqual(got.URL, tt.want.URL) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 11 18:09:14 UTC 2024
    - 4.6K bytes
    - Viewed (0)
  4. src/net/http/fs_test.go

    		}
    		body, err := io.ReadAll(res.Body)
    		res.Body.Close()
    		if err != nil {
    			t.Fatal(err)
    		}
    		wantBody := file
    		if method == MethodHead {
    			wantBody = nil
    		}
    		if !bytes.Equal(body, wantBody) {
    			t.Fatalf("%v: got body %q, want %q", method, body, wantBody)
    		}
    		if got, want := res.Header.Get("Content-Length"), fmt.Sprint(len(file)); got != want {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 23:39:44 UTC 2024
    - 49.9K bytes
    - Viewed (0)
  5. src/net/http/clientserver_test.go

    func testHandlerWritesTooMuch(t *testing.T, mode testMode) {
    	wantBody := []byte("123")
    	cst := newClientServerTest(t, mode, HandlerFunc(func(w ResponseWriter, r *Request) {
    		rc := NewResponseController(w)
    		w.Header().Set("Content-Length", fmt.Sprintf("%v", len(wantBody)))
    		rc.Flush()
    		w.Write(wantBody)
    		rc.Flush()
    		n, err := io.WriteString(w, "x") // too many
    		if err == nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 46.6K bytes
    - Viewed (0)
  6. src/net/http/client_test.go

    		t.Fatal(err)
    	}
    	defer resp.Body.Close()
    	if resp.StatusCode != 200 {
    		t.Fatal(resp.Status)
    	}
    	if got, err := io.ReadAll(resp.Body); err != nil || string(got) != wantBody {
    		t.Errorf("body = %q; want %q", got, wantBody)
    	}
    }
    
    // Issue 17494: cookies should be altered when Client follows redirects.
    func TestClientAltersCookiesOnRedirect(t *testing.T) { run(t, testClientAltersCookiesOnRedirect) }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 21:30:50 UTC 2024
    - 63.8K bytes
    - Viewed (0)
  7. src/net/http/serve_test.go

    			t.Errorf("%q. unexpected error: %v", badTE, err)
    			continue
    		}
    
    		wantBody := fmt.Sprintf("" +
    			"HTTP/1.1 501 Not Implemented\r\nContent-Type: text/plain; charset=utf-8\r\n" +
    			"Connection: close\r\n\r\nUnsupported transfer encoding")
    
    		if string(gotBody) != wantBody {
    			t.Errorf("%q. body\ngot\n%q\nwant\n%q", badTE, gotBody, wantBody)
    		}
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 07 17:57:01 UTC 2024
    - 202K bytes
    - Viewed (0)
  8. src/net/http/transport_test.go

    	c := &Client{Transport: tr}
    
    	testResponse := func(req *Request, name string, wantCode int) {
    		t.Helper()
    		res, err := c.Do(req)
    		if err != nil {
    			t.Fatalf("%s: Do: %v", name, err)
    		}
    		if res.StatusCode != wantCode {
    			t.Fatalf("%s: Response Statuscode=%d; want %d", name, res.StatusCode, wantCode)
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jun 06 21:59:21 UTC 2024
    - 192.6K bytes
    - Viewed (0)
  9. pilot/pkg/xds/debug_test.go

    	tests := []struct {
    		name     string
    		wantCode int
    		proxyID  string
    	}{
    		{
    			name:     "dumps most recent proxy with 200",
    			proxyID:  "test.default",
    			wantCode: 200,
    		},
    		{
    			name:     "returns 404 if proxy not found",
    			proxyID:  "not-found",
    			wantCode: 404,
    		},
    		{
    			name:     "returns 400 if no proxyID",
    			proxyID:  "",
    			wantCode: 400,
    		},
    	}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri Jan 12 18:20:36 UTC 2024
    - 7.8K bytes
    - Viewed (0)
  10. istioctl/cmd/sysexits_test.go

    	analyze.AnalyzerFoundIssuesError{}:                             ExitAnalyzerFoundIssues,
    }
    
    func TestKnownExitStrings(t *testing.T) {
    	for err, wantCode := range KnownErrorCode {
    		if code := GetExitCode(err); code != wantCode {
    			t.Errorf("For %v want %v, but is %v", err, wantCode, code)
    		}
    	}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Jun 15 15:02:17 UTC 2023
    - 1.3K bytes
    - Viewed (0)
Back to top