element-hq / element-hq/element-android
[SDK] Add delegate function to allow dynamic setting of headers for all requests from outside the SDK code
- Dominant language
- Kotlin
- Stars
- 3.7k
- Forks
- 917
- PR merge metrics
- No merged PRs in 30d
Description
### Description
**What would you like to do?**
Whenever a request is made to the matrix server from the matrix SDK (e.g. send message) then would like a delegate method to be called (which can be hooked into from the app) and extra headers can be set.
**Why would you like to do it?**
Set extra request headers for security.
**How would you like to achieve it?**
In the app be able to hook into a "onRequestBuild" delegate function and define your own dynamic headers...
matrixSdk.onRequestBuild = (requestBuilder: Request.Builder) {
requestBuilder.header("My-Authorization", "Bearer ${token}")
requestBuilder.header("Another-One", "another value")
requestBuilder.header("Local-Time", Datetime.now())
}
**Have you considered any alternatives?**
Yes only alternative is to copy all the SDK code into the app then make the adjustments directly to the SDK.
Contributor guide
Assessment
This issue has not been assessed yet.