Http: send user agent (#27549)
This commit is contained in:
parent
5ecf7795b8
commit
17808be721
1 changed files with 6 additions and 0 deletions
|
|
@ -92,6 +92,12 @@ func dump(r io.ReadCloser, w *strings.Builder) error {
|
|||
func (r *roundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
r.log.TRACE.Printf("%s %s", req.Method, req.URL.String())
|
||||
|
||||
// add evcc user agent
|
||||
if req.Header.Get("User-Agent") == "" {
|
||||
req = req.Clone(req.Context())
|
||||
req.Header.Set("User-Agent", "evcc/"+util.FormattedVersion())
|
||||
}
|
||||
|
||||
// dump without headers
|
||||
var err error
|
||||
var save io.ReadCloser
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue