Skip to content

Commit

Permalink
feat: set User-Agent version based on package version (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanbuck-snyk authored Apr 16, 2024
1 parent 53cff4a commit 9c0eba4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "backstage-plugin-snyk",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"version": "0.0.0-development",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
Expand Down
3 changes: 2 additions & 1 deletion src/api/SnykApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { mockedDepGraphs } from "../utils/mockedDepGraphs";
import { mockedProjectDetails } from "../utils/mockedProjectDetails";
import { IssuesCount } from "../types/types";
import { Issue } from "../types/unifiedIssuesTypes";
const pkg = require('../../package.json');
const DEFAULT_PROXY_PATH_BASE = "";

type Options = {
Expand Down Expand Up @@ -80,7 +81,7 @@ export class SnykApiClient implements SnykApi {

private headers = {
"Content-Type": "application/json",
"User-Agent": "tech-services/backstage-plugin/1.0",
"User-Agent": `tech-services/backstage-plugin/${pkg.version || "0.0.0-development"}`,
};

constructor(options: Options) {
Expand Down

0 comments on commit 9c0eba4

Please sign in to comment.