Preparing search index...

    Handle to an in-progress HTTP request returned by performHttpRequestWithReply; must be retained to keep the connection alive.

        // HttpReply is returned by performHttpRequestWithReply and exposes
    // three signals: onData, onEnd, and onError for streaming responses.
    const { HttpRequest, performHttpRequestWithReply } = await import('LensStudio:Network');

    const request = new HttpRequest();
    request.url = 'https://httpbin.org/get';
    request.method = HttpRequest.Method.Get;

    const reply = performHttpRequestWithReply(request);

    // onData fires for each chunk of response data (Editor.Buffer)
    this.connections.push(
    reply.onData.connect((chunk: Editor.Buffer) => {
    console.log('Received data chunk:', chunk.toString().length, 'chars');
    })
    );

    // onEnd fires once with the final HttpResponse when complete
    this.connections.push(
    reply.onEnd.connect((response: import('LensStudio:Network').HttpResponse) => {
    console.log('Request complete, status:', response.statusCode);
    console.log('Content-Type:', response.contentType);
    })
    );

    // onError fires if the request fails
    this.connections.push(
    reply.onError.connect((response: import('LensStudio:Network').HttpResponse) => {
    console.log('Request error:', response.error);
    })
    );

    console.log('HttpReply created with onData, onEnd, onError signals connected');

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    onData: signal1<Buffer, void>

    Signal fired when a chunk of response data is received, providing an Editor.Buffer with the chunk contents.

    onEnd: signal1<HttpResponse, void>

    Signal fired when the HTTP response has fully completed, providing the final HttpResponse.

    onError: signal1<HttpResponse, void>

    Signal fired when the HTTP request encounters an error, providing the HttpResponse with error details.

    Methods

    • Beta

      Returns the name of this object's type.

      Returns string

    • Beta

      Returns true if the object is of the specified type.

      Parameters

      • type: string

      Returns boolean