Setu-TS
    Preparing search index...

    Interface IAuthHttp

    Outbound HTTP seam used to fetch key sets, read discovery documents, and exchange an authorization code at a provider's token endpoint. Defaults to one over fetch. An implementation must reject once the response body exceeds maxBytes while reading it, and must honour signal.

    0.8.0

    interface IAuthHttp {
        get(
            url: string,
            options: {
                headers?: Readonly<Record<string, string>>;
                maxBytes: number;
                signal: AbortSignal;
            },
        ): Promise<{ body: string; status: number }>;
        post(
            url: string,
            options: {
                form: Readonly<Record<string, string>>;
                headers?: Readonly<Record<string, string>>;
                maxBytes: number;
                signal: AbortSignal;
            },
        ): Promise<{ body: string; status: number }>;
    }
    Index
    • Performs a GET request.

      Parameters

      • url: string

        Absolute URL

      • options: {
            headers?: Readonly<Record<string, string>>;
            maxBytes: number;
            signal: AbortSignal;
        }

        Abort signal, response-body byte limit, and any extra request headers (the sign-in userinfo read sends its bearer access token here)

      Returns Promise<{ body: string; status: number }>

      The status code and the body as text

    post

    • post(
          url: string,
          options: {
              form: Readonly<Record<string, string>>;
              headers?: Readonly<Record<string, string>>;
              maxBytes: number;
              signal: AbortSignal;
          },
      ): Promise<{ body: string; status: number }>

      Performs a POST whose body is form encoded as application/x-www-form-urlencoded, for the OAuth 2.0 token endpoint.

      form is passed as a map rather than a pre-encoded string so the seam, not each caller, owns the encoding: a secret containing & or + must not be able to inject a second parameter into the request.

      Parameters

      • url: string

        Absolute URL

      • options: {
            form: Readonly<Record<string, string>>;
            headers?: Readonly<Record<string, string>>;
            maxBytes: number;
            signal: AbortSignal;
        }

        Abort signal, response-body byte limit, the form fields, and any extra request headers (for example the client_secret_basic credential)

      Returns Promise<{ body: string; status: number }>

      The status code and the body as text

      0.8.0