Skip to content

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Nov 15, 2024

Motivation:

The server response types have a metadata computed property with only a getter. It's entirely possible to mutate the metadata manually, it's just a bit of a faff. This should be easier.

Modifications:

  • Add a setter to the computed property
  • Migrate server response tests to swift-testing

Result:

  • Easier to use API

Motivation:

The server response types have a metadata computed property with only a
getter. It's entirely possible to mutate the metadata manually, it's
just a bit of a faff. This should be easier.

Modifications:

- Add a setter to the computed property
- Migrate server response tests to swift-testing

Result:

- Easier to use API
Comment on lines +258 to +264
switch self.accepted {
case var .success(contents):
contents.metadata = newValue
self.accepted = .success(contents)
case var .failure(error):
error.metadata = newValue
self.accepted = .failure(error)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a side note: This might be prone to CoWs and something we might want to make @inlinable or use a consuming switch

@glbrntt glbrntt merged commit dd22b39 into grpc:main Nov 15, 2024
44 of 46 checks passed
@glbrntt glbrntt deleted the v2/mutate-metadata branch November 15, 2024 15:44
@rnro rnro mentioned this pull request Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants