Skip to content

feat: enhance curl command handling with file uploads#1358

Merged
k1LoW merged 1 commit intomainfrom
update-curlreq
Nov 23, 2025
Merged

feat: enhance curl command handling with file uploads#1358
k1LoW merged 1 commit intomainfrom
update-curlreq

Conversation

@k1LoW
Copy link
Owner

@k1LoW k1LoW commented Nov 23, 2025

This pull request updates how curl command parsing is handled in the runbook package, specifically improving support for file uploads in curl data arguments. The main change is the removal of custom logic for expanding curl data files in favor of a new approach provided by an updated dependency. Additionally, the code now supports specifying a working directory for curl file uploads, and related tests and test data have been updated accordingly.

Curl command parsing and file upload improvements:

  • Replaced the custom expandCurlDataFiles function with the new curlreq.Parser (from the updated github.com/k1LoW/curlreq v0.4.0), which now handles file expansion for curl data arguments. This simplifies the code and leverages upstream improvements. (runbook.go, go.mod) [1] [2] [3]
  • Added a wd (working directory) field to the runbook struct and set its default to "." to support specifying the working directory for curl file uploads, which is now passed to the parser. (runbook.go) [1] [2]

Testing updates:

  • Added a new test case for a curl command with a file upload and corresponding golden file and test data. (runbook_test.go, testdata/curl_command_with_file.append_step.golden, testdata/test.json) [1] [2] [3]
  • Removed the now-obsolete TestExpandCurlDataFiles and its supporting code, since file expansion is handled by the updated dependency. (runbook_test.go)

Minor cleanup:

  • Removed the unused slices import from runbook.go.

@k1LoW k1LoW self-assigned this Nov 23, 2025
@github-actions
Copy link
Contributor

BenchmarkManyRunbooks-4

main (-) #1358 (45f8cb5) +/-
Number of iterations 1 1 0
Nanoseconds per iteration 3,606,535,880 ns/op 3,630,403,208 ns/op 23,867,328 ns/op
Bytes allocated per iteration 1,384,345,184 B/op 1,384,505,776 B/op 160,592 B/op
Allocs per iteration 19,452,463 allocs/op 19,452,461 allocs/op -2 allocs/op
Metadata
main (-) #1358 (45f8cb5)
goos linux linux
goarch amd64 amd64
pkg github.com/k1LoW/runn github.com/k1LoW/runn
cpu AMD EPYC 7763 64-Core Processor AMD EPYC 7763 64-Core Processor

BenchmarkOpenAPI3-4

main (-) #1358 (45f8cb5) +/-
Number of iterations 1 1 0
Nanoseconds per iteration 2,693,639,735 ns/op 2,495,072,429 ns/op -198,567,306 ns/op
Bytes allocated per iteration 1,265,819,080 B/op 1,266,126,448 B/op 307,368 B/op
Allocs per iteration 18,458,912 allocs/op 18,459,218 allocs/op 306 allocs/op
Metadata
main (-) #1358 (45f8cb5)
goos linux linux
goarch amd64 amd64
pkg github.com/k1LoW/runn github.com/k1LoW/runn
cpu AMD EPYC 7763 64-Core Processor AMD EPYC 7763 64-Core Processor

BenchmarkSingleRunbook-4

main (-) #1358 (45f8cb5) +/-
Number of iterations 22 25 3
Nanoseconds per iteration 46,049,034 ns/op 46,354,545 ns/op 305,511 ns/op
Bytes allocated per iteration 23,122,069 B/op 23,101,057 B/op -21,012 B/op
Allocs per iteration 188,395 allocs/op 188,372 allocs/op -23 allocs/op
Metadata
main (-) #1358 (45f8cb5)
goos linux linux
goarch amd64 amd64
pkg github.com/k1LoW/runn github.com/k1LoW/runn
cpu AMD EPYC 7763 64-Core Processor AMD EPYC 7763 64-Core Processor

Reported by octocov

@github-actions
Copy link
Contributor

Code Metrics Report

main (a089a23) #1358 (45f8cb5) +/-
Coverage 60.3% 60.1% -0.2%
Code to Test Ratio 1:0.8 1:0.8 -0.1
Test Execution Time 7m47s 6m59s -48s
Details
  |                     | main (a089a23) | #1358 (45f8cb5) |  +/-  |
  |---------------------|----------------|-----------------|-------|
- | Coverage            |          60.3% |           60.1% | -0.2% |
  |   Files             |             80 |              80 |     0 |
  |   Lines             |           9243 |            9207 |   -36 |
- |   Covered           |           5576 |            5541 |   -35 |
- | Code to Test Ratio  |          1:0.8 |           1:0.8 |  -0.1 |
  |   Code              |          17267 |           17211 |   -56 |
- |   Test              |          14393 |           14281 |  -112 |
+ | Test Execution Time |          7m47s |           6m59s |  -48s |

Code coverage of files in pull request scope (80.4% → 78.6%)

Files Coverage +/- Status
runbook.go 78.6% -1.9% modified

Reported by octocov

@k1LoW k1LoW marked this pull request as ready for review November 23, 2025 11:30
@k1LoW k1LoW merged commit 9949743 into main Nov 23, 2025
9 checks passed
@k1LoW k1LoW deleted the update-curlreq branch November 23, 2025 11:31
@github-actions github-actions bot mentioned this pull request Nov 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant