Skip to content

Commit

Permalink
editorial
Browse files Browse the repository at this point in the history
  • Loading branch information
argouber committed Sep 23, 2019
1 parent bc5d8f4 commit ebc1c01
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions codegen/method.go
Expand Up @@ -1108,6 +1108,10 @@ func getQueryEncodeExpression(typeSpec compile.TypeSpec, valueName string) strin
return fmt.Sprintf(encodeExpression, valueName)
}

// hasQueryParams - checks to see if either this field has a query-param annotation
// or if this is a struct, some field in it has.
// Caveat is that unannotated fields are considered Query Params IF the REST method
// should not have a body (GET, DELETE). This is an existing convenience afforded to callers
func (ms *MethodSpec) hasQueryParams(field *compile.FieldSpec, defaultIsQuery bool) bool {

httpRefAnnotation := field.Annotations[ms.annotations.HTTPRef]
Expand Down Expand Up @@ -1140,8 +1144,6 @@ func (ms *MethodSpec) setWriteQueryParamStatements(
goPrefix string, thriftPrefix string, field *compile.FieldSpec,
) bool {
// Skip if there are no query params in the field or its components
// However, if by definition there is no request body, untagged fields are mapped to query-params
// because "existing behavior" && cannot easily change that
if !ms.hasQueryParams(field, hasNoBody) {
return false
}
Expand Down Expand Up @@ -1257,8 +1259,6 @@ func (ms *MethodSpec) setParseQueryParamStatements(
longQueryName := ms.getLongQueryName(field, thriftPrefix)

// Skip if there are no query params in the field or its components
// However, if by definition there is no request body, untagged fields are mapped to query-params
// because "existing behavior" && cannot easily change that
if !ms.hasQueryParams(field, hasNoBody) {
return false
}
Expand Down

0 comments on commit ebc1c01

Please sign in to comment.