Aman-Codes / pennamechooser

Pen Name Chooser is a website that helps you to select a unique pen name for your online presence.
https://pennamechooser.onrender.com/
MIT License
20 stars 17 forks source link

Fixes #2 - Fix the HackerEarth API #8

Closed IanFindlay closed 1 year ago

IanFindlay commented 1 year ago

Issue that this pull request solves

Closes: #2

Proposed changes

The problem was that even when the username isn't found on the HackerEarth site the status code the website returns is 200. I found a way to identify the 404 page by changing the axios request to a 'get' instead of a 'head' - in order to get the data response - and looking within that data for a '404 error' element.

Types of changes

Put an x in the boxes that apply

Checklist

Put an x in the boxes that apply

Screenshots

Please attach the screenshots of the changes made in case of change in user interface

Other information

Any other information that is important to this pull request