Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'json()' response format #361

Open
allenheltondev opened this issue Mar 21, 2023 · 1 comment
Open

Add 'json()' response format #361

allenheltondev opened this issue Mar 21, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@allenheltondev
Copy link

When I get a response from a get call or a subscription, I'd like the sdk to parse json for me optionally.

I often store stringified json objects as cache items and when I receive a response, it would be a nice developer experience to have it returned as an object. Thinking something like this:

const getResponse = await cacheClient.get('myCache', 'key');
if(getResponse instanceof CacheGet.Hit) {
  const myObject = getResponse.json();
}

If the value is not a stringified object, I'd expect an error to be thrown if this is called.

@allenheltondev allenheltondev added the enhancement New feature or request label Mar 21, 2023
@allenheltondev
Copy link
Author

You can see an example in Postman's documentation here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant