Skip to content

Add overload for empty requests#502

Merged
mtmk merged 2 commits into
mainfrom
request-empty-reply
May 29, 2024
Merged

Add overload for empty requests#502
mtmk merged 2 commits into
mainfrom
request-empty-reply

Conversation

@mtmk

@mtmk mtmk commented May 29, 2024

Copy link
Copy Markdown
Member

Proposing a convenience method where request payload isn't required in request-reply calls. It is fairly common to request data without sending any payload. With this method application code can avoid boilerplate null data parameter and request type parameter making the call much more succinct.

// current way of sending an empty request payload
var reply1 = await nats.RequestAsync<object, int>(subject, data: null);

// proposed API. calls the method above
var reply2 = await nats.RequestAsync<int>(subject);

mtmk added 2 commits May 29, 2024 17:59
Convenience method where request payload isn't required.
@mtmk
mtmk requested a review from caleblloyd May 29, 2024 17:08

@caleblloyd caleblloyd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Seems valuable! LGTM

@mtmk
mtmk merged commit 177112b into main May 29, 2024
@mtmk
mtmk deleted the request-empty-reply branch May 29, 2024 17:57
@mtmk mtmk changed the title [PROPOSAL] Add overload for empty requests Add overload for empty requests May 29, 2024
mtmk added a commit that referenced this pull request Jun 11, 2024
* Add ResumeAtRevision support to KV Watcher (#491)
* prefer sub channel ReadAllAsync and rm SubAnchor (#507)
* Keep sub alive when reading channel (#506)
* Add overload for empty requests (#502)
@mtmk mtmk mentioned this pull request Jun 11, 2024
mtmk added a commit that referenced this pull request Jun 11, 2024
* Add ResumeAtRevision support to KV Watcher (#491)
* prefer sub channel ReadAllAsync and rm SubAnchor (#507)
* Keep sub alive when reading channel (#506)
* Add overload for empty requests (#502)
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.

2 participants