backend-common: smol tweak + lint fix

Co-authored-by: Johan Haals <johan.haals@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-07-01 14:00:53 +02:00
parent 21febfaeb1
commit a2a3912834
3 changed files with 6 additions and 9 deletions
@@ -109,12 +109,9 @@ export class GithubUrlReader implements UrlReader {
}
if (response.ok) {
const etag = response.headers.get('ETag')
? response.headers.get('ETag')!
: undefined;
return {
buffer: async () => Buffer.from(await response.text()),
etag,
etag: response.headers.get('ETag') ?? undefined,
};
}
@@ -213,7 +213,7 @@ describe('GitlabUrlReader', () => {
rest.get('*/api/v4/projects/:name', (_, res, ctx) =>
res(ctx.status(200), ctx.json({ id: 12345 })),
),
rest.get('*', (req, res, ctx) => {
rest.get('*', (_req, res, ctx) => {
return res(ctx.status(200), ctx.set('ETag', '999'), ctx.body('foo'));
}),
);
@@ -83,10 +83,10 @@ export class GitlabUrlReader implements UrlReader {
}
if (response.ok) {
const etag = response.headers.get('ETag')
? response.headers.get('ETag')!
: undefined;
return { buffer: async () => Buffer.from(await response.text()), etag };
return {
buffer: async () => Buffer.from(await response.text()),
etag: response.headers.get('ETag') ?? undefined,
};
}
const message = `${url} could not be read as ${builtUrl}, ${response.status} ${response.statusText}`;