Interface ISmileTestHttpClient

All Known Implementing Classes:
SmileTestHttpClient

public sealed interface ISmileTestHttpClient permits SmileTestHttpClient
What SmileHarness.getHttpClient() hands back: the request-issuing part of a SmileTestHttpClient, without its lifecycle.

This interface is deliberately not AutoCloseable: the owner keeps SmileTestHttpClient.close() and SmileTestHttpClient.getClient(), so a borrower cannot shut the pool down on every other client sharing it. That is a guard against a mistake, not a boundary ? casting back to SmileTestHttpClient reaches both. It is sealed to that one class for the same reason: hiding the lifecycle is the interface's whole job, so a second implementation would be one whose pool nothing can release.

A handle is not stateless. Every request issued through request(String) shares one cookie store and one connection pool with everything else on the same client, which is what makes a multi-request login flow work and what clearCookies() ends. cookielessRequest(String) opts out of the cookie store while keeping the pool.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Discards every cookie held by this client, ending any session established by prior requests.
    ca.uhn.fhir.test.utilities.HttpTestRequest
    cookielessRequest(FhirContext theFhirContext, String theUrl)
    Starts building a cookie-free request that can carry a FHIR resource body, encoded with the given context.
    ca.uhn.fhir.test.utilities.HttpTestRequest
    Starts building a request that neither sends nor stores cookies, while still using this client's connection pool.
    ca.uhn.fhir.test.utilities.HttpTestRequest
    request(FhirContext theFhirContext, String theUrl)
    Starts building a request that can carry a FHIR resource body, encoded with the given context.
    ca.uhn.fhir.test.utilities.HttpTestRequest
    request(String theUrl)
    Starts building a request against a full URL, issued on this client so that it shares the cookie store and connection pool with everything else sent through it.
  • Method Details

    • request

      @Nonnull ca.uhn.fhir.test.utilities.HttpTestRequest request(@Nonnull String theUrl)
      Starts building a request against a full URL, issued on this client so that it shares the cookie store and connection pool with everything else sent through it.
      Parameters:
      theUrl - the full request URL
    • request

      @Nonnull ca.uhn.fhir.test.utilities.HttpTestRequest request(@Nonnull FhirContext theFhirContext, @Nonnull String theUrl)
      Starts building a request that can carry a FHIR resource body, encoded with the given context.
      Parameters:
      theFhirContext - the context used to encode resource bodies
      theUrl - the full request URL
      See Also:
    • cookielessRequest

      @Nonnull ca.uhn.fhir.test.utilities.HttpTestRequest cookielessRequest(@Nonnull String theUrl)
      Starts building a request that neither sends nor stores cookies, while still using this client's connection pool. Use it to assert what a caller carrying no session gets back: a request built with request(String) would replay whatever session an earlier request established, and could be answered as that user.
      Parameters:
      theUrl - the full request URL
    • cookielessRequest

      @Nonnull ca.uhn.fhir.test.utilities.HttpTestRequest cookielessRequest(@Nonnull FhirContext theFhirContext, @Nonnull String theUrl)
      Starts building a cookie-free request that can carry a FHIR resource body, encoded with the given context.
      Parameters:
      theFhirContext - the context used to encode resource bodies
      theUrl - the full request URL
      See Also:
    • clearCookies

      void clearCookies()
      Discards every cookie held by this client, ending any session established by prior requests.