зеркало из https://github.com/Azure/go-autorest.git
fix few misspell and one small cleaning (#339)
* fix parameter misspell * fix response misspell * use strings.Contains instead strings.Index * fix absence misspell * fix Parameters misspell * fix equivalent misspell * fix possibility misspell * fix attempts misspell * fix separator misspell * fix possibly misspell
This commit is contained in:
Родитель
a27e766634
Коммит
4b1fb3a5d3
|
@ -69,7 +69,7 @@ func NewAPIKeyAuthorizer(headers map[string]interface{}, queryParameters map[str
|
|||
return &APIKeyAuthorizer{headers: headers, queryParameters: queryParameters}
|
||||
}
|
||||
|
||||
// WithAuthorization returns a PrepareDecorator that adds an HTTP headers and Query Paramaters
|
||||
// WithAuthorization returns a PrepareDecorator that adds an HTTP headers and Query Parameters.
|
||||
func (aka *APIKeyAuthorizer) WithAuthorization() PrepareDecorator {
|
||||
return func(p Preparer) Preparer {
|
||||
return DecoratePreparer(p, WithHeaders(aka.headers), WithQueryParameters(aka.queryParameters))
|
||||
|
|
|
@ -689,7 +689,7 @@ func (pt *pollingTrackerPatch) updatePollingMethod() error {
|
|||
}
|
||||
}
|
||||
// for 202 prefer the Azure-AsyncOperation header but fall back to Location if necessary
|
||||
// note the absense of the "final GET" mechanism for PATCH
|
||||
// note the absence of the "final GET" mechanism for PATCH
|
||||
if pt.resp.StatusCode == http.StatusAccepted {
|
||||
ao, err := getURLFromAsyncOpHeader(pt.resp)
|
||||
if err != nil {
|
||||
|
|
|
@ -104,7 +104,7 @@ func TestNewErrorWithResponse_Forwards(t *testing.T) {
|
|||
e2 := NewErrorWithResponse("packageType", "method", nil, "message %s", "arg")
|
||||
|
||||
if !reflect.DeepEqual(e1, e2) {
|
||||
t.Fatal("autorest: NewError did not return an error equivelent to NewErrorWithError")
|
||||
t.Fatal("autorest: NewError did not return an error equivalent to NewErrorWithError")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ func TestNewErrorWithError_Forwards(t *testing.T) {
|
|||
e2 := NewErrorWithError(nil, "packageType", "method", nil, "message %s", "arg")
|
||||
|
||||
if !reflect.DeepEqual(e1, e2) {
|
||||
t.Fatal("autorest: NewError did not return an error equivelent to NewErrorWithError")
|
||||
t.Fatal("autorest: NewError did not return an error equivalent to NewErrorWithError")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ func (sf SenderFunc) Do(r *http.Request) (*http.Response, error) {
|
|||
return sf(r)
|
||||
}
|
||||
|
||||
// SendDecorator takes and possibily decorates, by wrapping, a Sender. Decorators may affect the
|
||||
// SendDecorator takes and possibly decorates, by wrapping, a Sender. Decorators may affect the
|
||||
// http.Request and pass it along or, first, pass the http.Request along then react to the
|
||||
// http.Response result.
|
||||
type SendDecorator func(Sender) Sender
|
||||
|
|
|
@ -926,6 +926,6 @@ func TestDoRetryForStatusCodes_Cancel429(t *testing.T) {
|
|||
t.Fatalf("expected status code 429, got: %d", r.StatusCode)
|
||||
}
|
||||
if client.Attempts() >= retries {
|
||||
t.Fatalf("too many attemps: %d", client.Attempts())
|
||||
t.Fatalf("too many attempts: %d", client.Attempts())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ func AsStringSlice(s interface{}) ([]string, error) {
|
|||
}
|
||||
|
||||
// String method converts interface v to string. If interface is a list, it
|
||||
// joins list elements using the seperator. Note that only sep[0] will be used for
|
||||
// joins list elements using the separator. Note that only sep[0] will be used for
|
||||
// joining if any separator is specified.
|
||||
func String(v interface{}, sep ...string) string {
|
||||
if len(sep) == 0 {
|
||||
|
|
|
@ -1918,7 +1918,7 @@ func TestValidate_IntPointer(t *testing.T) {
|
|||
createError(reflect.ValueOf(n), v[0].Constraints[0].Chain[0],
|
||||
"value must be greater than 100").Error())
|
||||
|
||||
// required paramter
|
||||
// required parameter
|
||||
p = nil
|
||||
v = []Validation{
|
||||
{p,
|
||||
|
@ -1966,7 +1966,7 @@ func TestValidate_IntStruct(t *testing.T) {
|
|||
createError(reflect.ValueOf(n), v[0].Constraints[0].Chain[0].Chain[0],
|
||||
"value must be greater than 100").Error())
|
||||
|
||||
// required paramter
|
||||
// required parameter
|
||||
p = &Product{}
|
||||
v = []Validation{
|
||||
{p, []Constraint{{"p", Null, true,
|
||||
|
@ -2023,7 +2023,7 @@ func TestValidate_String(t *testing.T) {
|
|||
createError(reflect.ValueOf(s), v[0].Constraints[1].Chain[0],
|
||||
"value length must be less than or equal to 3").Error())
|
||||
|
||||
// required paramter
|
||||
// required parameter
|
||||
s = ""
|
||||
v = []Validation{
|
||||
{s,
|
||||
|
@ -2038,7 +2038,7 @@ func TestValidate_String(t *testing.T) {
|
|||
createError(reflect.ValueOf(s), v[0].Constraints[1],
|
||||
"value can not be null or empty; required parameter").Error())
|
||||
|
||||
// not required paramter
|
||||
// not required parameter
|
||||
s = ""
|
||||
v = []Validation{
|
||||
{s,
|
||||
|
@ -2081,7 +2081,7 @@ func TestValidate_StringStruct(t *testing.T) {
|
|||
createError(reflect.ValueOf(s), v[0].Constraints[0].Chain[0].Chain[1],
|
||||
"value length must be less than or equal to 3").Error())
|
||||
|
||||
// required paramter - can't be Empty
|
||||
// required parameter - can't be Empty
|
||||
s = ""
|
||||
p = &Product{
|
||||
Str: &s,
|
||||
|
@ -2100,7 +2100,7 @@ func TestValidate_StringStruct(t *testing.T) {
|
|||
createError(reflect.ValueOf(s), v[0].Constraints[0].Chain[0].Chain[0],
|
||||
"value can not be null or empty; required parameter").Error())
|
||||
|
||||
// required paramter - can't be null
|
||||
// required parameter - can't be null
|
||||
p = &Product{}
|
||||
v = []Validation{
|
||||
{p, []Constraint{{"p", Null, true,
|
||||
|
@ -2193,7 +2193,7 @@ func TestValidate_Array(t *testing.T) {
|
|||
createError(reflect.ValueOf(s1), v[0].Constraints[0],
|
||||
"value can not be null; required parameter").Error())
|
||||
|
||||
// not required paramter
|
||||
// not required parameter
|
||||
v = []Validation{
|
||||
{s1,
|
||||
[]Constraint{
|
||||
|
@ -2255,7 +2255,7 @@ func TestValidate_ArrayPointer(t *testing.T) {
|
|||
createError(reflect.ValueOf(s1), v[0].Constraints[0],
|
||||
"value can not be null; required parameter").Error())
|
||||
|
||||
// not required paramter
|
||||
// not required parameter
|
||||
v = []Validation{
|
||||
{s1,
|
||||
[]Constraint{
|
||||
|
@ -2289,7 +2289,7 @@ func TestValidate_ArrayInStruct(t *testing.T) {
|
|||
createError(reflect.ValueOf(s), v[0].Constraints[0].Chain[0].Chain[1],
|
||||
fmt.Sprintf("minimum item limit is 2; got: %v", len(s))).Error())
|
||||
|
||||
// required paramter - can't be Empty
|
||||
// required parameter - can't be Empty
|
||||
p = &Product{
|
||||
Arr: &[]string{},
|
||||
}
|
||||
|
@ -2307,7 +2307,7 @@ func TestValidate_ArrayInStruct(t *testing.T) {
|
|||
createError(reflect.ValueOf([]string{}), v[0].Constraints[0].Chain[0].Chain[0],
|
||||
"value can not be null or empty; required parameter").Error())
|
||||
|
||||
// required paramter - can't be null
|
||||
// required parameter - can't be null
|
||||
p = &Product{}
|
||||
v = []Validation{
|
||||
{p, []Constraint{{"p", Null, true,
|
||||
|
@ -2366,7 +2366,7 @@ func TestValidate_StructInStruct(t *testing.T) {
|
|||
createError(reflect.ValueOf(p.C.I), v[0].Constraints[0].Chain[0].Chain[0],
|
||||
"value length must be greater than or equal to 7").Error())
|
||||
|
||||
// required paramter - can't be Empty
|
||||
// required parameter - can't be Empty
|
||||
p = &Product{
|
||||
C: &Child{I: ""},
|
||||
}
|
||||
|
@ -2382,7 +2382,7 @@ func TestValidate_StructInStruct(t *testing.T) {
|
|||
createError(reflect.ValueOf(p.C.I), v[0].Constraints[0].Chain[0].Chain[0],
|
||||
"value can not be null or empty; required parameter").Error())
|
||||
|
||||
// required paramter - can't be null
|
||||
// required parameter - can't be null
|
||||
p = &Product{}
|
||||
v = []Validation{
|
||||
{p, []Constraint{{"p", Null, true,
|
||||
|
|
|
@ -162,7 +162,7 @@ type Writer interface {
|
|||
// WriteResponse writes the specified HTTP response to the logger if the log level is greater than
|
||||
// or equal to LogInfo. The response body, if set, is logged at level LogDebug or higher.
|
||||
// Custom filters can be specified to exclude URL, header, and/or body content from the log.
|
||||
// By default no respone content is excluded.
|
||||
// By default no response content is excluded.
|
||||
WriteResponse(resp *http.Response, filter Filter)
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ func (fl fileLogger) WriteResponse(resp *http.Response, filter Filter) {
|
|||
// returns true if the provided body should be included in the log
|
||||
func (fl fileLogger) shouldLogBody(header http.Header, body io.ReadCloser) bool {
|
||||
ct := header.Get("Content-Type")
|
||||
return fl.logLevel >= LogDebug && body != nil && strings.Index(ct, "application/octet-stream") == -1
|
||||
return fl.logLevel >= LogDebug && body != nil && !strings.Contains(ct, "application/octet-stream")
|
||||
}
|
||||
|
||||
// creates standard header for log entries, it contains a timestamp and the log level
|
||||
|
|
Загрузка…
Ссылка в новой задаче