Skip to content

Bug with undefined handling #28

Description

@olessavluk

Hello,

In this file https://github.com/comapi/comapi-sdk-js/blob/master/src/profile.ts

    /**
     * 
     * @param useEtag 
     */
    private getMyProfileETag(useEtag: boolean): Promise<string> {
        if (useEtag) {
            return this._localStorage.getString("MyProfileETag");
        } else {
            return Promise.resolve(undefined);
        }
    }

Promise<string> and Promise.resolve(undefined) are incompatible, there should be type error.

Later when this undefined saved in localStorage it is converted to a string and being sent with ETag as "undefined". This cause request to fail with HTTP error code 412

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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