Add enhanced function for error message handling in http request for configuration fetching#5712
Conversation
add Header User-Agent for request client.
for more information, see https://pre-commit.ci
…lientConfig on conditioning.
1. add enhanced function for error handler to log out the exact reason that the config is failed to fetch 2. once the http status is not correct in certain status code and the old config data is avaliable, use the old config data and log the message to warn the user.
|
Surge PR preview deployment was removed |
|
please dont include issue number in title |
I found that it has the restriction of import of the shared/ toward the woodpecker-go, therefore I add the codes into the woodpecker-go either.
…ithub.com:LUKIEYF/woodpecker into feature/5292
|
Hi @LUKIEYF sorry for not coming back to you for a long time. Can you check the linter and the tests? |
No problem, buddy. Will do on Monday as soon as possible. :) |
|
The linter and test case issues are solved, please review. thank you! |
6543
left a comment
There was a problem hiding this comment.
the server/services/utils/http_error.go is quite extensive. I wonder if we could reuse it in other woodpecker code paths too ...
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5712 +/- ##
==========================================
+ Coverage 21.61% 21.75% +0.14%
==========================================
Files 428 429 +1
Lines 38738 38844 +106
==========================================
+ Hits 8372 8450 +78
- Misses 29596 29604 +8
- Partials 770 790 +20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
I have moved the http_error.go and http_error_test.go to the /shared/httputil, please see whether it is proper. thank you! |
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
This reverts commit e91a67d.
it is just used to grap the host name |
|
@6543 no. If there's an error, it is set to the full endpoint. I still consider this a security risk, nothing critical, but I would not return that endpoint in the error. And it's also possible that the admin would like to hide the host as well. |
closes #5292
add enhanced function for error handler to log out the exact reason that the config is failed to fetch
once the http status is not correct in certain status code and the old config data is available, use the old config data and log the message to warn the user.
related enhancedHttpError() function testing codes and related createPipeline() function scenarios testings are added.
please kindly review and give the comments, thank you all! : )