abhijeetnishal / URLShortener

URL Shortener Deployed Link 👇🏻
https://urlsrtner.vercel.app
MIT License
37 stars 61 forks source link

Solved the bug for validating urls returning status code other than 200 #139

Closed Srikar04 closed 1 month ago

Srikar04 commented 1 month ago

Fixes: #137

Description: This pull request addresses the issue where the URL validation logic in the isValidURL middleware incorrectly considers URLs as valid even when the HTTP status code is not 200. The fix modifies the checkWebsite function to properly handle status codes other than 200, ensuring accurate URL validation by defining a set of Valid URL's and a retry mechanism upto 3 times

Tests: Conducted manual testing to ensure that URLs with non-200 status codes are correctly identified as invalid by the isValidURL middleware.

Test 1: Input url: https://www.linkedin.com/in/srikarmellachervu/ Status Code: 999 Output: sol

Test 2: Input url: https://redis.io/docs/latest/develop/use/ Status code: 200 Output: sol

vercel[bot] commented 1 month ago

@Srikar04 is attempting to deploy a commit to the Abhijeet's projects Team on Vercel.

A member of the Team first needs to authorize it.

abhijeetnishal commented 1 month ago

Hey @Srikar04, I have approved this PR although it has more latency but it is also more robust solution.

abhijeetnishal commented 1 month ago

Hey @Srikar04, i have merged this PR. Star this repo to support our project and share with your network.

Thanks for contributing.