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

Add subscript accessor to Headers #2393

Open
Augustyniak opened this issue Jun 28, 2022 · 2 comments
Open

Add subscript accessor to Headers #2393

Augustyniak opened this issue Jun 28, 2022 · 2 comments
Assignees

Comments

@Augustyniak
Copy link
Contributor

Add a more ergonomic way to access header values stored by Headers. This is for both iOS and Android.

The Swift implementation could look like:

subscript(name: String) -> [String]? {
  get {
    return self.container.value(forName: name)
  }
}
@Augustyniak
Copy link
Contributor Author

Confirmed that the implementation of transcript accessor is possible in Kotlin too:

operator fun get(i: SomeType) : SomeOtherType { /* */ }

Documentation https://kotlinlang.org/docs/operator-overloading.html#indexed-access-operator

@Augustyniak
Copy link
Contributor Author

@jpsim I am planning to add transcript operators to Headers and keeping value(forName: methods on Headers at the same time. Users will have two ways to access headers in a case-insensitive way. Let me know if you think that we should get rid of value(forName: option.

@Augustyniak Augustyniak self-assigned this Sep 7, 2022
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

No branches or pull requests

2 participants