Skip to content

Commit

Permalink
fix #58
Browse files Browse the repository at this point in the history
  • Loading branch information
Moebits committed Oct 19, 2024
1 parent 3c38636 commit aa4c73c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class API {
if (this.oauthToken) options.query.oauth_token = this.oauthToken
return request(URI, options).then(r => {
if (r.statusCode.toString().startsWith("2")) {
if (r.headers["content-type"] === "application/json") return r.body.json()
if (r.headers["content-type"].includes("application/json")) return r.body.json()
return r.body.text()
}
throw new Error(`Status code ${r.statusCode}`)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "soundcloud.ts",
"version": "0.6.1",
"version": "0.6.2",
"description": "Soundcloud API v2 wrapper with typings.",
"main": "dist/soundcloud.js",
"types": "dist/soundcloud.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import SoundCloud from "./soundcloud"
require("dotenv").config()
const soundcloud = new SoundCloud(process.env.SOUNDCLOUD_CLIENT_ID, process.env.SOUNDCLOUD_OAUTH_TOKEN);
(async () => {
const result = await soundcloud.users.likes("https://soundcloud.com/soundcloud")
console.log(result.map((t) => t.permalink_url))
const result = await soundcloud.users.tracks("gingaloid")
console.log(result)
})()

0 comments on commit aa4c73c

Please sign in to comment.