[BUG] File Metadata Test 4 fails with "blob is not implemented yet"

Description

The File Metadata Microservice project Test #4 (“When you submit a file, you receive the file name, type, and size in bytes within the JSON response”) fails with an error in the test runner, not in my code.

Error Message


Error: blob is not implemented yet

The Problem

Looking at the FCC test code:


const formData = new FormData();

const fileData = await fetch(

'https://cdn.freecodecamp.org/weather-icons/01d.png'

);

const file = await fileData.blob(); // <-- This fails

formData.append('upfile', file, 'icon');

The test uses response.blob() method which is not implemented in the FCC test runner’s sandboxed environment.

Proof My Code Works

Testing with curl shows correct response:


$ curl -F "upfile=@test.png" https://my-file-metadata.onrender.com/api/fileanalyse

{"name":"test.png","type":"image/png","size":12345}

Additional Info

  • FCC’s own example URL also fails this test when submitted

  • Tests 1, 2, and 3 pass correctly

  • Browser: Chrome (latest)

  • File upload works perfectly when tested manually through the UI

Expected Behavior

The test should pass when the API correctly returns JSON with name, type, and size properties.

Suggested Fix

Either:

  1. Implement response.blob() in the test runner

  2. Or use a different method to create the test file (e.g., create a Blob directly without fetching)


My Project: FCC-Backend/projects/file-metadata at main · bhavyup/FCC-Backend · GitHub

Live URL: https://fcc-file-metadata-xvgc.onrender.com

It’s another instance where the fetch function isn’t all the way implemented by the browser.

It has nothing to do with the test-runner.