-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improvements #1
improvements #1
Conversation
-Add feature: request only headers. Please let me know what do you think about these suggestions. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The edits done make my code better and optimized.
Thanks for your help.
So I made some improvements.
Your Bug:
The bug was because you were printing on the console the error message from your fetch() instead of considering that error as a BAD URL (if fetch fails because the URL is BAD).
-Request only HEADERS. (optimization)
Now your fetch just requests the HEADERS. It will save time and space for your application.
-Timeout of 1.5secs (optimization)
If a server does not send a life-signal in 1.5secs, your fetch will throw an error.
-Callback hell.
You were in callback hell. A lot of "IFs" nested and so on. (David has a good video about it. I will send the link to you).
I tried to change it, but you can still working on it.
-function messageOne()
I just put your message inside a function to help us exit from callback hell.