| 94 | } |
| 95 | |
| 96 | func TestRequestWithErrorWontChange(t *testing.T) { |
| 97 | gvCopy := v1.SchemeGroupVersion |
| 98 | original := Request{ |
| 99 | err: errors.New("test"), |
| 100 | content: ContentConfig{GroupVersion: &gvCopy}, |
| 101 | } |
| 102 | r := original |
| 103 | changed := r.Param("foo", "bar"). |
| 104 | AbsPath("/abs"). |
| 105 | Prefix("test"). |
| 106 | Suffix("testing"). |
| 107 | Namespace("new"). |
| 108 | Resource("foos"). |
| 109 | Name("bars"). |
| 110 | Body("foo"). |
| 111 | Timeout(time.Millisecond) |
| 112 | if changed != &r { |
| 113 | t.Errorf("returned request should point to the same object") |
| 114 | } |
| 115 | if !reflect.DeepEqual(changed, &original) { |
| 116 | t.Errorf("expected %#v, got %#v", &original, changed) |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | func TestRequestPreservesBaseTrailingSlash(t *testing.T) { |
| 121 | r := &Request{baseURL: &url.URL{}, pathPrefix: "/path/"} |