Skip to content

Commit 7916834

Browse files
committed
updating to [email protected]
1 parent 15b753b commit 7916834

File tree

6 files changed

+11
-26
lines changed

6 files changed

+11
-26
lines changed

lib/resolver.content.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,9 @@ export default class PodletClientContentResolver {
3939
*/
4040
// @ts-expect-error Deliberate default empty options for better error messages
4141
constructor(options = {}) {
42-
this.#http =
43-
options.http ||
44-
new HttpClient({
45-
throwOn400: false,
46-
throwOn500: false,
47-
});
4842
const name = options.clientName;
4943
this.#log = abslog(options.logger);
44+
this.#http = options.http || new HttpClient({ logger: this.#log });
5045
this.#metrics = new Metrics();
5146
this.#histogram = this.#metrics.histogram({
5247
name: 'podium_client_resolver_content_resolve',

lib/resolver.fallback.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ export default class PodletClientFallbackResolver {
3434
*/
3535
// @ts-expect-error Deliberate default empty options for better error messages
3636
constructor(options = {}) {
37-
this.#http = options.http || new HttpClient();
3837
const name = options.clientName;
3938
this.#log = abslog(options.logger);
39+
this.#http = options.http || new HttpClient({ logger: this.#log });
4040
this.#metrics = new Metrics();
4141
this.#histogram = this.#metrics.histogram({
4242
name: 'podium_client_resolver_fallback_resolve',

lib/resolver.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export default class PodletClientResolver {
3434

3535
const log = abslog(options.logger);
3636
const httpClient = new HttpClient({
37-
throwOn400: false,
38-
throwOn500: false,
37+
clientName: options.clientName,
38+
logger: log,
3939
});
4040
this.#cache = new Cache(registry, options);
4141
this.#manifest = new Manifest({

lib/resolver.manifest.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const UA_STRING = `${pkg.name} ${pkg.version}`;
2222
* @typedef {object} PodletClientManifestResolverOptions
2323
* @property {string} clientName
2424
* @property {import('abslog').AbstractLoggerOptions} [logger]
25-
* @property {import('./http.js').default} [http]
25+
* @property {import('@podium/http-client').default} [http]
2626
*/
2727

2828
export default class PodletClientManifestResolver {
@@ -37,14 +37,9 @@ export default class PodletClientManifestResolver {
3737
*/
3838
// @ts-expect-error Deliberate default empty options for better error messages
3939
constructor(options = {}) {
40-
this.#http =
41-
options.http ||
42-
new HttpClient({
43-
throwOn400: true,
44-
throwOn500: true,
45-
});
4640
const name = options.clientName;
4741
this.#log = abslog(options.logger);
42+
this.#http = options.http || new HttpClient({ logger: this.#log });
4843
this.#metrics = new Metrics();
4944
this.#histogram = this.#metrics.histogram({
5045
name: 'podium_client_resolver_manifest_resolve',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"dependencies": {
4040
"@hapi/boom": "10.0.1",
4141
"@metrics/client": "2.5.3",
42-
"@podium/http-client": "1.0.0-beta.3",
42+
"@podium/http-client": "1.0.0-beta.4",
4343
"@podium/schemas": "5.0.6",
4444
"@podium/utils": "5.3.1",
4545
"abslog": "2.4.4",

tests/resolver.test.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,19 @@ tap.test(
4141
const metrics = [];
4242
stream.on('data', (metric) => metrics.push(metric));
4343
stream.on('end', async () => {
44-
t.equal(metrics.length, 3);
44+
t.equal(metrics.length, 2);
45+
4546
t.equal(metrics[0].name, 'http_client_breaker_events');
4647
t.equal(metrics[0].type, 2);
4748
t.same(metrics[0].labels[0], {
48-
name: 'name',
49-
value: 'fire',
50-
});
51-
t.equal(metrics[1].name, 'http_client_breaker_events');
52-
t.equal(metrics[1].type, 2);
53-
t.same(metrics[1].labels[0], {
5449
name: 'name',
5550
value: 'success',
5651
});
5752
t.equal(
58-
metrics[2].name,
53+
metrics[1].name,
5954
'podium_client_resolver_manifest_resolve',
6055
);
61-
t.equal(metrics[2].type, 5);
56+
t.equal(metrics[1].type, 5);
6257
resolve();
6358
});
6459
});

0 commit comments

Comments
 (0)