Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Commit

Permalink
Removed API version from header
Browse files Browse the repository at this point in the history
  • Loading branch information
jusexton committed Aug 26, 2020
1 parent a13310f commit 73b910b
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 0.4.1

- Removed api version header

# 0.4.0

- Updated API to comply with contact message service v0.6.0

# 0.3.0
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jsextonn/portfolio-api-client",
"version": "0.4.0",
"version": "0.4.1",
"description": "NodeJS client for portfolio API",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
6 changes: 0 additions & 6 deletions src/common/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ export type Headers = { [headerName: string]: any };
export interface ClientConfig {
host: string;
jwt?: string;
version?: string;
}

export class ClientConfigWrapper {
Expand All @@ -27,7 +26,6 @@ export class ClientConfigWrapper {
get headers(): Headers {
return {
Authorization: `Bearer ${this.config.jwt}`,
"X-PORTFOLIO-VERSION": this.config.version,
};
}

Expand All @@ -38,10 +36,6 @@ export class ClientConfigWrapper {
get jwt(): string | undefined {
return this.config.jwt;
}

get version(): string | undefined {
return this.config.version;
}
}

export abstract class BaseClient {
Expand Down
1 change: 0 additions & 1 deletion src/common/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
export interface PortfolioRequest {
jwt?: string;
version?: string;
}

export interface RequestWithParameters<T> extends PortfolioRequest {
Expand Down
6 changes: 6 additions & 0 deletions src/common/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ export interface PortfolioResponse<T = any> {
export interface Meta {
message: string;
errorDetails: ErrorDetail[];
paginationDetails: PaginationDetails;
schemas: { [schemaName: string]: any };
}

export interface ErrorDetail {
description: string;
fieldName: string;
}

export interface PaginationDetails {
page: number;
limit: number;
}
5 changes: 0 additions & 5 deletions test/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,4 @@ describe("client config wrapper", () => {
const headers = configWrapper.headers;
expect(headers["Authorization"]).toEqual(`Bearer ${config.jwt}`);
});

it("should correctly attach version to custom header", () => {
const headers = configWrapper.headers;
expect(headers["X-PORTFOLIO-VERSION"]).toEqual(config.version);
});
});
2 changes: 0 additions & 2 deletions test/contact.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jest.mock("axios");
describe("message service", () => {
const config: ClientConfig = {
host: "123",
version: "v1.0",
jwt: "123.jwt.abc",
};

Expand All @@ -29,7 +28,6 @@ describe("message service", () => {

it("should have expected config", () => {
expect(client.config.host).toBe(config.host);
expect(client.config.version).toBe(config.version);
expect(client.config.jwt).toBe(config.jwt);
});

Expand Down

0 comments on commit 73b910b

Please sign in to comment.