URL Shortener Microservice not getting passing even though i complete all tasks

I completed all tasks but one task is getting fail even though I passed that as well. My url shortner is getting the error response which I want to get but test is not getting pass.

task which im getting failed - If you pass an invalid URL that doesn’t follow the valid http://www.example.com format, the JSON response will contain { error: 'invalid url' }

my project link on glitch.
the live site link to my project.

thanks

below was my regexp code.

/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g

I changed that as below. and its solved. thanks!

/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g