Skip to content

Fix: Handle Null JSON Body in Spotify API Response - #8752

Merged
JhaSourav07 merged 1 commit into
JhaSourav07:mainfrom
tmdeveloper007:fix/8684-null-json-body-spotify
Aug 6, 2026
Merged

Fix: Handle Null JSON Body in Spotify API Response#8752
JhaSourav07 merged 1 commit into
JhaSourav07:mainfrom
tmdeveloper007:fix/8684-null-json-body-spotify

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Description

Added try-catch around response.json() in services/spotify/api.ts.

Pillar

  • Other (Bug fix, refactoring, docs)

Checklist

  • I have read the CONTRIBUTING.md file.
  • My commits follow the Conventional Commits format.

Note

Please assign this PR to the tmdeveloper007 account.

Closes #8684

@retenta-bot

retenta-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

This pull request addresses the issue of handling null JSON bodies in the Spotify API response, which is crucial for maintaining the robustness of our application. Similar past decisions have focused on improving error handling in the Spotify integration, ensuring that we gracefully manage unexpected API responses. Thank you for your contribution, and please let me know if you need any further assistance!

@retenta-bot retenta-bot Bot changed the title fix : handle null JSON body in Spotify getCurrentlyPlaying response Fix: Handle Null JSON Body in Spotify API Response Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

✨ No significant bundle size changes detected.

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 4939.27 KB 4939.27 KB 0 B
Total CSS 348.46 KB 348.46 KB 0 B

@Aamod007 Aamod007 added level:beginner Small changes Usually isolated fixes or simple UI/text updates. quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:bug Something isn't working as expected mentor:Aamod007 labels Aug 6, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good defensive programming! Wrapping the
esponse.json()\ call in a try-catch block inside \services/spotify/api.ts\ is exactly the right approach to gracefully handle cases where the Spotify API returns a 204 No Content or a malformed JSON response. It prevents unhandled promise rejections. Looks solid.

@JhaSourav07 JhaSourav07 added the gssoc:approved PR has been reviewed and accepted for valid contribution points label Aug 6, 2026
@JhaSourav07
JhaSourav07 merged commit 5dc4393 into JhaSourav07:main Aug 6, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved PR has been reviewed and accepted for valid contribution points level:beginner Small changes Usually isolated fixes or simple UI/text updates. mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix : handle null JSON body in Spotify getCurrentlyPlaying response

3 participants