Skip to content

Cancel method is not propagated to then promises #176

@zakjan

Description

@zakjan

I'm submitting a feature request

  • Library Version:
    1.2.1

Current behavior:
cancel method exists only on the promise returned by send method. If then is called on this promise, the returned promise doesn't have cancel method.

@autoinject
export class BackendRepository {
    constructor(private httpClient: HttpClient) {}

    getItems(): Promise<Item[]> {
        return this.httpClient.createRequest("/items").asGet().send()
            .then((responseData: any) => responseData.data);
    }
}

In this example, HTTP response needs to be unwrapped from a response envelope to return proper types to TS app. But it can't be cancelled in upper layers of the TS app, where the request was triggered.

Expected/desired behavior:

  • What is the expected behavior?
    The promise returned by then should have cancel method.

  • What is the motivation / use case for changing the behavior?
    To allow cancelling promises after callbacks are applied.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions