Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for upcomingHeaderKeys (0.26 sec)

  1. src/net/textproto/reader.go

    	}
    	return nil
    }
    
    var nl = []byte("\n")
    
    // upcomingHeaderKeys returns an approximation of the number of keys
    // that will be in this header. If it gets confused, it returns 0.
    func (r *Reader) upcomingHeaderKeys() (n int) {
    	// Try to determine the 'hint' size.
    	r.R.Peek(1) // force a buffer load if empty
    	s := r.R.Buffered()
    	if s == 0 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 19:57:43 UTC 2024
    - 22.1K bytes
    - Viewed (0)
  2. src/net/textproto/reader_test.go

    	}, {
    		input: "A: v\r\n\r\nB: v\r\nC: v\r\n",
    		want:  1,
    	}, {
    		input: "A: v" + strings.Repeat("\n", 1000),
    		want:  1,
    	}} {
    		r := reader(test.input)
    		got := r.upcomingHeaderKeys()
    		if test.want != got {
    			t.Fatalf("upcomingHeaderKeys(%q): %v; want %v", test.input, got, test.want)
    		}
    	}
    }
    
    func TestReadMIMEHeaderNoKey(t *testing.T) {
    	r := reader(": bar\ntest-1: 1\n\n")
    	m, err := r.ReadMIMEHeader()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 05 18:31:56 UTC 2024
    - 14.7K bytes
    - Viewed (0)
Back to top