Fix webhook sync HTTP 302 failure
Hi, thank you for maintaining Health Connect Webhook.
I am using v1.9.14 with a Google Apps Script Web App endpoint like:
https://script.google.com/macros/s/.../exec?token=...
Since v1.9.14, webhook sync fails with HTTP 302. The same Google Apps Script webhook worked on v1.5.
Example log:
- statusCode: 302
- success: false
- errorMessage: HTTP 302:
- syncType: manual
- app_version in payload: 1.9.14
Google Apps Script Web Apps commonly redirect /exec requests to script.googleusercontent.com with a 302 response before returning the final response. It looks like v1.9.14 currently disables redirect following in WebhookManager.kt:
Kotlinprivate val client = OkHttpClient.Builder()
.connectTimeout(TIMEOUT_SECONDS, TimeUnit.SECONDS)
.readTimeout(TIMEOUT_SECONDS, TimeUnit.SECONDS)
.writeTimeout(TIMEOUT_SECONDS, TimeUnit.SECONDS)
.followRedirects(false)
.build()
In v1.5 this line was not present, so OkHttp followed redirects by default and Google Apps Script webhooks worked.
Request:
Could you please allow webhook delivery to follow redirects again, or add an option to enable redirect following per webhook?
A minimal fix appears to be removing:
Kotlin.followRedirects(false)
This would restore OkHttp's default redirect behavior and should fix Google Apps Script endpoints that return 302 before the final 2xx response.
If possible, it would also be helpful if webhook logs included the Location header for 3xx responses, so redirect issues are easier to diagnose.
Thank you!