Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: use context for HTTP request in discord#5232

Merged
caarlos0 merged 1 commit into
goreleaser:mainfrom
alexandear:fix/discord-announce-ctx
Oct 31, 2024
Merged

feat: use context for HTTP request in discord#5232
caarlos0 merged 1 commit into
goreleaser:mainfrom
alexandear:fix/discord-announce-ctx

Conversation

@alexandear
Copy link
Copy Markdown
Contributor

@alexandear alexandear commented Oct 31, 2024

The PR adds using context.Context in the POST request.

Context is a request scoped paradigm according to the doc.

The PR adds API field into the Config for utilizing it in tests.

@pull-request-size pull-request-size Bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 31, 2024
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 82.00%. Comparing base (c68d830) to head (024a40b).
Report is 655 commits behind head on main.

Files with missing lines Patch % Lines
internal/pipe/discord/discord.go 62.50% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5232      +/-   ##
==========================================
- Coverage   83.77%   82.00%   -1.77%     
==========================================
  Files         135      141       +6     
  Lines       13029    13915     +886     
==========================================
+ Hits        10915    11411     +496     
- Misses       1677     2021     +344     
- Partials      437      483      +46     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pull-request-size pull-request-size Bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 31, 2024
@alexandear alexandear changed the title fix: use context for HTTP request in discord feat: use context for HTTP request in discord Oct 31, 2024
@caarlos0 caarlos0 merged commit b269cc9 into goreleaser:main Oct 31, 2024
@caarlos0
Copy link
Copy Markdown
Member

thank you!

@alexandear alexandear deleted the fix/discord-announce-ctx branch October 31, 2024 15:48
caarlos0 pushed a commit that referenced this pull request Nov 16, 2024
This PR adds using `context.Context` in HTTP requests. Changes are
similar to #5232.

Additionally, it enables `noctx` to automatically detect missing
context:
```
internal/pipe/webhook/webhook.go:85:29: should rewrite http.NewRequestWithContext or add (*Request).WithContext (noctx)
internal/pipe/linkedin/client.go:68:27: (*net/http.Client).Get must not be called (noctx)
internal/pipe/linkedin/client.go:101:27: (*net/http.Client).Get must not be called (noctx)
internal/pipe/linkedin/client.go:172:28: (*net/http.Client).Post must not be called (noctx)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants