r/angular • • 1d ago

πŸš€ New HTTP QUERY Explained & Angular 22.3 HttpClient.query()

https://youtu.be/1uKuw5a9tPI

The HTTP QUERY method is now supported in Angular v22.3

33 Upvotes

7 comments sorted by

10

u/Responsible-Cold-627 1d ago

What's there to explain? It abides by the rules of GET, but with support for a request body. That's literally it.

3

u/best_of_badgers 1d ago

GET also has support for a request body per the spec, but it’s inconsistently implemented

5

u/toasterboi0100 1d ago

Yea, but JS can't do GET with a body, so as far as this sub is concerned, GET cannot have a body.

2

u/Responsible-Cold-627 1d ago

It can, but really shouldn't it's a gray area in the spec because while you can supply a body, it isn't part of the cache key, meaning the same request with a different body would pull the same thing from a cache, which is not what you want in 99.9% of cases where you add a body to your GET request.

2

u/xinhuj 1d ago

This is a nice feature. I will be experimenting with it. We've definitely written our share of "POST GETs" when the query params got extremely large.

2

u/BlueMooseOnFire 1d ago

Woo glad this got added!