refactor!: extract simulation helpers out of simapp#13402
Conversation
| // PostRequest defines a wrapper around an HTTP POST request with a provided URL and data. | ||
| // An error is returned if the request or reading the body fails. | ||
| func PostRequest(url string, contentType string, data []byte) ([]byte, error) { | ||
| res, err := http.Post(url, contentType, bytes.NewBuffer(data)) //nolint:gosec |
Check failure
Code scanning / gosec
Potential HTTP request made with variable url
| // GetRequest defines a wrapper around an HTTP GET request with a provided URL. | ||
| // An error is returned if the request or reading the body fails. | ||
| func GetRequest(url string) ([]byte, error) { | ||
| res, err := http.Get(url) //nolint:gosec |
Check failure
Code scanning / gosec
Potential HTTP request made with variable url
| tc := tc | ||
| s.Run(tc.name, func() { | ||
| resp, _ := rest.GetRequest(tc.url) | ||
| resp, _ := testutil.GetRequest(tc.url) |
Check warning
Code scanning / gosec
Returned error is not propagated up the stack.
| return nil, fmt.Errorf("error while sending post request: %w", err) | ||
| } | ||
| defer func() { | ||
| _ = res.Body.Close() |
Check warning
Code scanning / gosec
Returned error is not propagated up the stack.
| return nil, err | ||
| } | ||
| defer func() { | ||
| _ = res.Body.Close() |
Check warning
Code scanning / gosec
Returned error is not propagated up the stack.
| uri := fmt.Sprintf(balanceURL, tc.args.Owner, tc.args.ClassID) | ||
| s.Run(tc.name, func() { | ||
| resp, _ := rest.GetRequest(uri) | ||
| resp, _ := testutil.GetRequest(uri) |
Check warning
Code scanning / gosec
Returned error is not propagated up the stack.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #13402 +/- ##
==========================================
- Coverage 54.31% 53.90% -0.42%
==========================================
Files 637 657 +20
Lines 54601 56651 +2050
==========================================
+ Hits 29658 30539 +881
- Misses 22562 23679 +1117
- Partials 2381 2433 +52
|
Description
Closes: #13379
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!to the type prefix if API or client breaking changeCHANGELOG.mdReviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!in the type prefix if API or client breaking change