Pull request 1807: upd-golibs

Merge in DNS/adguard-home from upd-golibs to master

Squashed commit of the following:

commit cde42a72c2140245f345681cbb936ed3bc4645a1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Apr 7 13:57:02 2023 +0300

    all: upd golibs, use hdrs
This commit is contained in:
Ainar Garipov
2023-04-07 14:21:37 +03:00
parent f9fe3172c4
commit 15bba281ee
12 changed files with 59 additions and 61 deletions

View File

@@ -20,9 +20,11 @@ import (
"sync"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghhttp"
"github.com/AdguardTeam/AdGuardHome/internal/aghio"
"github.com/AdguardTeam/AdGuardHome/internal/aghos"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/httphdr"
"github.com/AdguardTeam/golibs/log"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
@@ -491,10 +493,10 @@ func prepareMultipartMsg(
}()
h := make(textproto.MIMEHeader)
h.Set("Content-Type", "application/json")
h.Set(httphdr.ContentType, aghhttp.HdrValApplicationJSON)
d := fmt.Sprintf("form-data; name=%q; filename=%q", "file", defaultBaseFile)
h.Set("Content-Disposition", d)
h.Set(httphdr.ContentDisposition, d)
fw, err = w.CreatePart(h)
if err != nil {
@@ -523,7 +525,7 @@ func send(uriStr, cType string, buf *bytes.Buffer) (err error) {
return fmt.Errorf("bad request: %w", err)
}
req.Header.Set("Content-Type", cType)
req.Header.Set(httphdr.ContentType, cType)
resp, err := client.Do(req)
if err != nil {