-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add WithContext
functions to executor
#161
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -234,9 +234,7 @@ func contains(haystack []string, needle string) bool { | |
} | ||
|
||
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { | ||
if bodyBuf == nil { | ||
bodyBuf = &bytes.Buffer{} | ||
} | ||
bodyBuf = &bytes.Buffer{} | ||
if reader, ok := body.(io.Reader); ok { | ||
_, err = bodyBuf.ReadFrom(reader) | ||
} else if b, ok := body.([]byte); ok { | ||
|
@@ -248,7 +246,7 @@ func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err e | |
} else if jsonCheck.MatchString(contentType) { | ||
err = json.NewEncoder(bodyBuf).Encode(body) | ||
} else if xmlCheck.MatchString(contentType) { | ||
xml.NewEncoder(bodyBuf).Encode(body) | ||
err = xml.NewEncoder(bodyBuf).Encode(body) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing error handling but I don't think this is being used |
||
} | ||
|
||
if err != nil { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,12 +139,12 @@ func (h *HttpRequester) prepareRequest( | |
// Encode the parameters. | ||
url.RawQuery = query.Encode() | ||
|
||
// Generate a new request | ||
if body != nil { | ||
localVarRequest, err = http.NewRequest(method, url.String(), body) | ||
localVarRequest, err = http.NewRequestWithContext(ctx, method, url.String(), body) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. context was propagated but not used at all before these changes |
||
} else { | ||
localVarRequest, err = http.NewRequest(method, url.String(), nil) | ||
localVarRequest, err = http.NewRequestWithContext(ctx, method, url.String(), nil) | ||
} | ||
|
||
if err != nil { | ||
return nil, err | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,5 @@ package rbac | |
|
||
type CreateOrUpdateApplicationRequest struct { | ||
// Application's name e.g.: Payment Processors | ||
Name string `json:"name"` | ||
Description string `json"description"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is no description in |
||
Name string `json:"name"` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary check