12 "compress/gzip"
13 "fmt"
14 "io"
15 "io/ioutil" 16 "os"
17 "path/filepath"
18 "strings"
167 r, _ := http.NewRequest("PUT", "/foo", nil)
168 handler.ServeHTTP(recorder, r)
169
170 headersVal := recorder.HeaderMap.Get(headerAllowHeaders)171 if headersVal != "Origin,Accept,Content-Type,Authorization" {
172 t.Errorf("Allow-Headers is expected to be Origin,Accept,Content-Type,Authorization; found %v", headersVal)
173 }
131 methodsVal := recorder.HeaderMap.Get(headerAllowMethods)
132 headersVal := recorder.HeaderMap.Get(headerAllowHeaders)
133 exposedHeadersVal := recorder.HeaderMap.Get(headerExposeHeaders)
134 maxAgeVal := recorder.HeaderMap.Get(headerMaxAge)135
136 if credentialsVal != "true" {
137 t.Errorf("Allow-Credentials is expected to be true, found %v", credentialsVal)
130 credentialsVal := recorder.HeaderMap.Get(headerAllowCredentials)
131 methodsVal := recorder.HeaderMap.Get(headerAllowMethods)
132 headersVal := recorder.HeaderMap.Get(headerAllowHeaders)
133 exposedHeadersVal := recorder.HeaderMap.Get(headerExposeHeaders)134 maxAgeVal := recorder.HeaderMap.Get(headerMaxAge)
135
136 if credentialsVal != "true" {
129
130 credentialsVal := recorder.HeaderMap.Get(headerAllowCredentials)
131 methodsVal := recorder.HeaderMap.Get(headerAllowMethods)
132 headersVal := recorder.HeaderMap.Get(headerAllowHeaders)133 exposedHeadersVal := recorder.HeaderMap.Get(headerExposeHeaders)
134 maxAgeVal := recorder.HeaderMap.Get(headerMaxAge)
135
Sometimes a function, variable, constant, field, or whole package becomes redundant or unnecessary but must be kept for compatibility with existing programs. These should not be used except for compatibility with legacy systems.