fix: add type json in headers#1614
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangescreateClient helper refactoring
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Tagging OptionsShould a new tag be published when this PR is merged?
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@verified-reviews/utils/client.ts`:
- Around line 151-155: The Promise.all type cast on lines 151-155 declares the
second result as Reviews | null, but since reviews() returns Promise<Reviews[]>
and flat() was removed, responseReview is actually an array at runtime. This
causes lines 162/164 to try accessing object properties like stats and reviews
from an array, resulting in incomplete or undefined data. Update the Promise.all
type cast to declare the second result as Reviews[] instead of Reviews | null so
the subsequent code that accesses stats and reviews properties on lines 162/164
operates on the correct shape.
- Line 110: The `reviews` function is declared as `async` but does not contain
any `await` expressions, which causes a CI/static-analysis failure. Remove the
`async` keyword from the `reviews` function declaration since it directly
returns the result of `fetchAPI(...)` without awaiting any asynchronous
operations. This will align the function signature with its actual behavior and
clear the failing check.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a73d5be6-f000-401a-b122-243357388166
📒 Files selected for processing (1)
verified-reviews/utils/client.ts
|
|
||
| /** @description https://documenter.getpostman.com/view/2336519/SVzw6MK5#daf51360-c79e-451a-b627-33bdd0ef66b8 */ | ||
| const reviews = ( | ||
| const reviews = async ( |
There was a problem hiding this comment.
Remove unnecessary async on reviews to clear the failing check
Line 110 declares reviews as async but returns fetchAPI(...) directly with no await, which matches the reported CI/static-analysis failure.
Suggested fix
- const reviews = async (
+ const reviews = (📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const reviews = async ( | |
| const reviews = ( |
🧰 Tools
🪛 GitHub Actions: ci / 0_Bundle & Check Apps (ubuntu-latest).txt
[error] 110-110: deno lint failed (require-await): Async arrow function has no 'await' expression or 'await using' declaration.
🪛 GitHub Actions: ci / Bundle & Check Apps (ubuntu-latest)
[error] 110-110: deno lint failed (require-await): Async arrow function has no 'await' expression or 'await using' declaration.
🪛 GitHub Check: Bundle & Check Apps (ubuntu-latest)
[failure] 110-110:
�[0m�[1mAsync arrow function has no 'await' expression or 'await using' declaration.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@verified-reviews/utils/client.ts` at line 110, The `reviews` function is
declared as `async` but does not contain any `await` expressions, which causes a
CI/static-analysis failure. Remove the `async` keyword from the `reviews`
function declaration since it directly returns the result of `fetchAPI(...)`
without awaiting any asynchronous operations. This will align the function
signature with its actual behavior and clear the failing check.
Source: Linters/SAST tools
There was a problem hiding this comment.
1 issue found across 1 file
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Adicionei "content-type": "application/json" nas três chamadas (rating, ratings, reviews).
Summary by cubic
Add JSON Content-Type to Verified Reviews POST requests and fix how
fullReviewformats and merges data. Prevents API failures and returns correctly structured reviews with stats.content-type: application/jsonforrating,ratings, andreviewsvia sharedjsonHeaders.fullReviewto merge ratings with the first reviews payload and includestats; map items withtoReview.fullReviewerror message and return empty arrays/undefined consistently.Written for commit fc385af. Summary will update on new commits.
Summary by CodeRabbit