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

[Discussion] HttpPromiseModule, promise support for http module #2613

Closed
BrodySmithPS opened this issue Jul 18, 2019 · 3 comments
Closed

[Discussion] HttpPromiseModule, promise support for http module #2613

BrodySmithPS opened this issue Jul 18, 2019 · 3 comments
Labels
needs triage This issue has not been looked into type: enhancement 🐺

Comments

@BrodySmithPS
Copy link

Feature Request

Is your feature request related to a problem? Please describe.

I don't like using observables for http requests. I would like to see the "option" of using Promises. This issue sums up my feelings on the matter perfectly #471

Describe the solution you'd like

I've created a HttpPromiseModule in my project that mirrors the HttpModule but without the Observable wrapping. This module is a lot easier to work with and matches the coding style on the backend better. I have a PR I can submit if you want to see the code.

Teachability, Documentation, Adoption, Migration Strategy

You use it the exact same way as the HttpModule except you use the HttpPromiseModule

What is the motivation / use case for changing the behavior?

Observables for http feels wrong/overkill. Tired of adding .toPromise() on all my http requests.

@BrodySmithPS BrodySmithPS added needs triage This issue has not been looked into type: enhancement 🐺 labels Jul 18, 2019
@marcus-sa
Copy link

marcus-sa commented Jul 19, 2019

You can just call .toPromise() on the observable, so I really don't see the issue here.

EDIT:
Didn't realize you mentioned this.

@kamilmysliwiec
Copy link
Member

As mentioned here, our recommended way is to use Observable #471

If you want to use Promises, call .toPromise.
If you don't want to call .toPromise, you can wrap HttpService in, let's say, HttpPromiseService and just override methods, call .super() and add .toPromise() so you don't have to do it over and over again. Bringing 2 different modules for the sake of 1 method call is an overkill

@lock
Copy link

lock bot commented Nov 6, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs triage This issue has not been looked into type: enhancement 🐺
Projects
None yet
Development

No branches or pull requests

3 participants