Skip to content

Commit

Permalink
Add type declaration for client.contentType
Browse files Browse the repository at this point in the history
Refs: #91
  • Loading branch information
tniessen authored and zbjornson committed Sep 19, 2021
1 parent 074f339 commit 3b66641
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ project adheres to [Semantic Versioning](http://semver.org/).

### Added

- fix: add type declaration for `client.contentType`

## [13.2.0] - 2021-08-08

### Changed
Expand Down
5 changes: 5 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ export type Collector = () => void;
*/
export const register: Registry;

/**
* The Content-Type of the metrics for use in the response headers.
*/
export const contentType: string;

export class AggregatorRegistry extends Registry {
/**
* Gets aggregated metrics for all workers.
Expand Down
5 changes: 5 additions & 0 deletions test/registerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,11 @@ describe('register', () => {
});
});

it('should have the same contentType as the module', () => {
const moduleWideContentType = require('../').contentType;
expect(register.contentType).toEqual(moduleWideContentType);
});

function getMetric(name) {
name = name || 'test_metric';
return {
Expand Down

0 comments on commit 3b66641

Please sign in to comment.