Skip to content

Fix double Response wrapping in url-summary function#2

Draft
Copilot wants to merge 1 commit intodrop-awsfrom
copilot/sub-pr-1
Draft

Fix double Response wrapping in url-summary function#2
Copilot wants to merge 1 commit intodrop-awsfrom
copilot/sub-pr-1

Conversation

Copy link

Copilot AI commented Jan 3, 2026

The getMeta function was returning a Response object, which the caller then wrapped in another Response object, causing incorrect double wrapping.

Changes:

  • Modified getMeta to return plain parsed JSON object instead of wrapping it in Response.json()
  • Caller now handles Response creation with proper status codes
// Before
export const getMeta = async(url, markup, tags) => {
    // ...
    const response = JSON.parse(chatCompletion.choices[0].message.content);
    return new Response.json(response, { status: 200 });  // ❌ Returns Response
}

// After  
export const getMeta = async(url, markup, tags) => {
    // ...
    const response = JSON.parse(chatCompletion.choices[0].message.content);
    return response;  // ✅ Returns plain object
}

The Netlify function handler continues to wrap the result in Response.json() at the appropriate layer.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI mentioned this pull request Jan 3, 2026
Copilot AI changed the title [WIP] Address feedback on 'Drop aws' pull request Fix double Response wrapping in url-summary function Jan 3, 2026
Copilot AI requested a review from simonmcmanus January 3, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants