attlaz-client 1.13.6 → 1.13.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,4 +5,5 @@ export declare class HttpClientResponse {
5
5
  body: any | null;
6
6
  headers: Headers;
7
7
  constructor(status: number, statusText: string);
8
+ getContentType(): string | null;
8
9
  }
@@ -7,4 +7,20 @@ export class HttpClientResponse {
7
7
  this.status = status;
8
8
  this.statusText = statusText;
9
9
  }
10
+ getContentType() {
11
+ let contentType = this.headers['content-type'];
12
+ if (contentType === null || contentType === undefined) {
13
+ return null;
14
+ }
15
+ if (Array.isArray(contentType)) {
16
+ [contentType] = contentType;
17
+ }
18
+ if (contentType === null || contentType === undefined) {
19
+ return null;
20
+ }
21
+ if (contentType.includes('application/json')) {
22
+ return 'json';
23
+ }
24
+ throw new Error('Unknown content type `' + contentType + '`');
25
+ }
10
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.13.6",
3
+ "version": "1.13.9",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",