mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-01 15:20:51 +00:00
Correctly use the extended got instance for target-state
In practice this fixes the missing user-agent Change-type: patch
This commit is contained in:
parent
6c7193e0c1
commit
63cc4ad58c
@ -120,7 +120,6 @@ export const update = async (
|
|||||||
const got = await getGotInstance();
|
const got = await getGotInstance();
|
||||||
|
|
||||||
const { statusCode, headers, body } = await got(endpoint, {
|
const { statusCode, headers, body } = await got(endpoint, {
|
||||||
responseType: 'json',
|
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${deviceApiKey}`,
|
Authorization: `Bearer ${deviceApiKey}`,
|
||||||
'If-None-Match': cache?.etag,
|
'If-None-Match': cache?.etag,
|
||||||
|
@ -69,24 +69,6 @@ const getRequestInstances = once(async () => {
|
|||||||
retryInterval: DEFAULT_REQUEST_RETRY_INTERVAL,
|
retryInterval: DEFAULT_REQUEST_RETRY_INTERVAL,
|
||||||
};
|
};
|
||||||
|
|
||||||
got.extend({
|
|
||||||
responseType: 'json',
|
|
||||||
decompress: true,
|
|
||||||
timeout: {
|
|
||||||
// TODO: We use the same default timeout for all of these in order to have a timeout generally
|
|
||||||
// but it would probably make sense to tune them individually
|
|
||||||
lookup: DEFAULT_REQUEST_TIMEOUT,
|
|
||||||
connect: DEFAULT_REQUEST_TIMEOUT,
|
|
||||||
secureConnect: DEFAULT_REQUEST_TIMEOUT,
|
|
||||||
socket: DEFAULT_REQUEST_TIMEOUT,
|
|
||||||
send: DEFAULT_REQUEST_TIMEOUT,
|
|
||||||
response: DEFAULT_REQUEST_TIMEOUT,
|
|
||||||
},
|
|
||||||
headers: {
|
|
||||||
'User-Agent': userAgent,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const requestHandle = requestLib.defaults(requestOpts);
|
const requestHandle = requestLib.defaults(requestOpts);
|
||||||
|
|
||||||
// @ts-expect-error promisifyAll is a bit wonky
|
// @ts-expect-error promisifyAll is a bit wonky
|
||||||
@ -96,7 +78,23 @@ const getRequestInstances = once(async () => {
|
|||||||
const resumable = resumableRequestLib.defaults(resumableOpts);
|
const resumable = resumableRequestLib.defaults(resumableOpts);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
got,
|
got: got.extend({
|
||||||
|
responseType: 'json',
|
||||||
|
decompress: true,
|
||||||
|
timeout: {
|
||||||
|
// TODO: We use the same default timeout for all of these in order to have a timeout generally
|
||||||
|
// but it would probably make sense to tune them individually
|
||||||
|
lookup: DEFAULT_REQUEST_TIMEOUT,
|
||||||
|
connect: DEFAULT_REQUEST_TIMEOUT,
|
||||||
|
secureConnect: DEFAULT_REQUEST_TIMEOUT,
|
||||||
|
socket: DEFAULT_REQUEST_TIMEOUT,
|
||||||
|
send: DEFAULT_REQUEST_TIMEOUT,
|
||||||
|
response: DEFAULT_REQUEST_TIMEOUT,
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
'User-Agent': userAgent,
|
||||||
|
},
|
||||||
|
}),
|
||||||
requestOpts,
|
requestOpts,
|
||||||
request,
|
request,
|
||||||
resumable,
|
resumable,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user