← All Angular Web Framework Flashcard Decks

HTTP Client & API Integration Flashcards

7 cards from real Angular Web Framework practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.

Read the first 7 HTTP Client & API Integration flashcards as text
  1. What is the role of HttpParams in Angular HTTP requests?

    Answer: Building an immutable, encodable set of URL query string parameters

    HttpParams provides an immutable fluent API to construct, set, append, and percent-encode query string parameters for HTTP requests.

  2. How do you make an HTTP request that bypasses all registered HttpInterceptors?

    Answer: Inject HttpBackend directly and use it to dispatch the request

    HttpBackend sits behind the interceptor chain; injecting and using it directly dispatches requests without passing through any interceptors.

  3. Which RxJS operator should be used to cancel a pending HTTP request when a new trigger value arrives, preventing stale responses?

    Answer: switchMap

    switchMap unsubscribes from the previous inner observable (aborting the in-flight request) and subscribes to the new one, discarding stale responses.

  4. Which combination of HttpClient options is required to receive HTTP upload progress events?

    Answer: reportProgress: true combined with observe: 'events', then filter for UploadProgress

    reportProgress: true enables progress tracking while observe: 'events' surfaces the event stream; you then filter for HttpEventType.UploadProgress events.

  5. What must an HttpInterceptor call to forward the request to the next interceptor or to the actual HTTP backend?

    Answer: next.handle(req)

    next.handle(req) passes the (potentially modified) HttpRequest to the next interceptor in the chain, or directly to the backend if none remain.

  6. What happens when HttpClient.get() is called but its returned Observable is never subscribed to?

    Answer: No HTTP request is sent because observables are cold and lazy

    HttpClient observables are cold — no HTTP request is made until something actively subscribes to the observable.

  7. How can you share a single HTTP request result among multiple subscribers without triggering duplicate network calls?

    Answer: Pipe the observable through shareReplay(1)

    shareReplay(1) multicasts the observable, executes the HTTP request once, and replays the cached response to any late subscribers.