Skip to content
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

Merged
merged 1 commit into from
Oct 1, 2020
Merged

improvements #1

merged 1 commit into from
Oct 1, 2020

Conversation

PedroFonsecaDEV
Copy link
Contributor

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.

@PedroFonsecaDEV
Copy link
Contributor Author

PedroFonsecaDEV commented Sep 29, 2020

-Add feature: request only headers.
-Add feature: fetch timeout.
-Propose of "-v" instead of "v"
-Better Formatting. (No callback hells)
-Probably I'm gonna create a new pull request with more improvements during this week.

Please let me know what do you think about these suggestions.

Thanks.
Pedro

Copy link
Owner

@mshinh mshinh left a 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.

index.js Show resolved Hide resolved
index.js Show resolved Hide resolved
index.js Show resolved Hide resolved
index.js Show resolved Hide resolved
index.js Show resolved Hide resolved
index.js Show resolved Hide resolved
@mshinh mshinh merged commit 5f83591 into mshinh:master Oct 1, 2020
mshinh pushed a commit that referenced this pull request Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants