lastfm-nodejs-client 1.4.5 → 1.4.6

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.
@@ -1,4 +1,4 @@
1
- import { type TopAlbumsResponse } from '../@types';
1
+ import { type TopAlbumsResponse } from "../@types";
2
2
  /**
3
3
  * GET: Top Albums - LastFM
4
4
  *
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getTopAlbums = void 0;
7
- const createOptions_1 = require("./createOptions");
8
7
  const request_1 = __importDefault(require("./request"));
8
+ const createOptions_1 = require("./createOptions");
9
9
  /**
10
10
  * GET: Top Albums - LastFM
11
11
  *
package/dist/cjs/index.js CHANGED
@@ -16,6 +16,7 @@ const method_1 = require("./method");
16
16
  const topTags_1 = require("./chart/topTags");
17
17
  const topTracks_1 = require("./chart/topTracks");
18
18
  const topArtists_1 = require("./chart/topArtists");
19
+ console.log('LastFmApi init>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
19
20
  function LastFmApi() {
20
21
  return {
21
22
  auth: auth_1.auth,
@@ -48,7 +48,11 @@ const request = async (options) => {
48
48
  }
49
49
  switch (res.status) {
50
50
  case 200: {
51
- return await res.json();
51
+ if (res.headers.get('content-type').includes('json')) {
52
+ const body = await res.json();
53
+ return body;
54
+ }
55
+ break;
52
56
  }
53
57
  case 400: {
54
58
  throw new Error('Bad request');
@@ -1,4 +1,4 @@
1
- import { type TopAlbumsResponse } from '../@types';
1
+ import { type TopAlbumsResponse } from "../@types";
2
2
  /**
3
3
  * GET: Top Albums - LastFM
4
4
  *
@@ -1,5 +1,5 @@
1
- import { createOptions } from './createOptions';
2
- import request from './request';
1
+ import request from "./request";
2
+ import { createOptions } from "./createOptions";
3
3
  /**
4
4
  * GET: Top Albums - LastFM
5
5
  *
package/dist/mjs/index.js CHANGED
@@ -14,6 +14,7 @@ import { method } from './method';
14
14
  import { chartTopTags } from './chart/topTags';
15
15
  import { chartTopTracks } from './chart/topTracks';
16
16
  import { chartTopArtists } from './chart/topArtists';
17
+ console.log('LastFmApi init>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
17
18
  export default function LastFmApi() {
18
19
  return {
19
20
  auth,
@@ -43,7 +43,11 @@ const request = async (options) => {
43
43
  }
44
44
  switch (res.status) {
45
45
  case 200: {
46
- return await res.json();
46
+ if (res.headers.get('content-type').includes('json')) {
47
+ const body = await res.json();
48
+ return body;
49
+ }
50
+ break;
47
51
  }
48
52
  case 400: {
49
53
  throw new Error('Bad request');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lastfm-nodejs-client",
3
- "version": "1.4.5",
3
+ "version": "1.4.6",
4
4
  "description": "A NodeJS wrapper client for LastFm API. Fetching public data by username using the LastFm public API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/mjs/index.js",