orangeCatDeveloper opened a new pull request, #4249:
URL: https://github.com/apache/hertzbeat/pull/4249

   ## What's changed?
   
   Fixes #3778
   
   Webhook notifications sent the URL through the `String` overload of
   `RestTemplate.postForEntity`, which treats it as a URI template and 
re-encodes
   it. Pre-encoded query params got corrupted — `sp=%2Ftriggers%2Fmanual%2Frun`
   went out as `sp=%252Ftriggers%252Fmanual%252Frun` — so signed webhook URLs
   (e.g. Microsoft Power Automate) always failed with `401 AuthorizationFailed`.
   
   The error message never showed the query string (Spring redacts it in
   exceptions), which made this look like the query was dropped. It was sent, 
but
   corrupted.
   
   The fix builds a `java.net.URI` up front and uses the `URI` overload, which
   sends the configured URL verbatim.
   
   ## Before
   
   <!-- screenshot: send test fails with 401 AuthorizationFailed -->
   
   ## After
   
   <!-- screenshot: send test succeeds against the same URL -->
   
   ## How this was verified
   
   - New regression test uses a real `RestTemplate` with 
`MockRestServiceServer`,
     asserting the request URI matches the configured URL byte-for-byte. It 
fails
     on the old code (`%252F` corruption) and passes with the fix.
   - Reproduced end-to-end against a real Power Automate endpoint: the same URL
     returns `202 Accepted` when sent verbatim (curl/Postman) and
     `401 AuthorizationFailed` through the old code path; with this fix the
     send-test succeeds from the HertzBeat UI.
   - `hertzbeat-alerter` module: 428 tests pass.
   
   ## Checklist
   
   - [x]  I have read the [Contributing 
Guide](https://hertzbeat.apache.org/docs/community/code_style_and_quality_guide)
   - [x]  I have written the necessary doc or comment.
   - [x]  I have added the necessary unit tests and all cases have passed.
   
   ## Add or update API
   
   - [ ] I have added the necessary [e2e 
tests](https://github.com/apache/hertzbeat/tree/master/e2e) and all cases have 
passed.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to