tq: ensure we pass the correct Accept header in verify requests

When we perform a verify request, we need to specify a proper Accept
header along with the Content-Type header. Do so.

Hoist the setting of the headers before the code which copies headers
from the remote side, so that the remote side can override it with a
suitable header if necessary. This is required for compatibility with
some existing servers.
This commit is contained in:
brian m. carlson 2019-05-22 17:51:09 +00:00
parent 381498010e
commit 61bc880d9e
No known key found for this signature in database
GPG Key ID: 2D0C9BC12F82B3A1

@ -35,10 +35,11 @@ func verifyUpload(c *lfsapi.Client, remote string, t *Transfer) error {
return err
}
req.Header.Set("Content-Type", "application/vnd.git-lfs+json")
req.Header.Set("Accept", "application/vnd.git-lfs+json")
for key, value := range action.Header {
req.Header.Set(key, value)
}
req.Header.Set("Content-Type", "application/vnd.git-lfs+json")
mv := c.GitEnv().Int(maxVerifiesConfigKey, defaultMaxVerifyAttempts)
mv = tools.MaxInt(defaultMaxVerifyAttempts, mv)