Skip to content
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

[feat] sse client support method and body configure #988

Merged
merged 3 commits into from
Mar 22, 2025

Conversation

vegetablechicken233
Copy link
Contributor

@vegetablechicken233 vegetablechicken233 commented Mar 21, 2025

Make HTTP Method configurable and add corresponding test functions.
It should be noted that to ensure backward compatibility, the "method" field does not perform empty validation, but is set to "GET" by default (to align with the old version).
In addition, type of "body" field is temporarily set to "io.Reader" (it seems a bit too early to add support for "any"~

Separated from PR #985

Copy link
Member

@jeevatkm jeevatkm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vegetablechicken233 Thanks for creating a new PR. Just one minor comment on godoc. Once fixed, I will get it merged.

sse.go Outdated
@@ -139,6 +150,14 @@ func (es *EventSource) SetHeader(header, value string) *EventSource {
return es
}

// SetBody method sets body value to the [EventSource] instance
//
// es.SetBody([]byte(`{"test":"put_data"}`),)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vegetablechicken233 This good example requires a correction based on method input type. Also, it has a syntax issue: , is present near the closing curve bracket.

es.SetBody(strings.NewReader(`{"test":"put_data"}`))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeevatkm already fix it

Copy link

codecov bot commented Mar 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.82%. Comparing base (981bb3f) to head (02cc4dd).
Report is 1 commits behind head on v3.

Additional details and impacted files
@@           Coverage Diff           @@
##               v3     #988   +/-   ##
=======================================
  Coverage   99.81%   99.82%           
=======================================
  Files          18       18           
  Lines        3885     3896   +11     
=======================================
+ Hits         3878     3889   +11     
  Misses          5        5           
  Partials        2        2           
Flag Coverage Δ
unittests 99.82% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

jeevatkm
jeevatkm previously approved these changes Mar 22, 2025
Copy link
Member

@jeevatkm jeevatkm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates.

@jeevatkm jeevatkm merged commit c639081 into go-resty:v3 Mar 22, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants