Skip to content

Commit c7137b6

Browse files
similiarityN2D4
andauthored
nicify Response (#668)
<!-- Make sure you've read the CONTRIBUTING.md guidelines: https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md --> <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > Enhance `getNicifiableKeys` to return `['status', 'headers']` for `Response` objects in `strings.tsx`. > > - **Enhancement**: > - `getNicifiableKeys` in `strings.tsx` now returns `['status', 'headers']` for `Response` objects. > - **Tests**: > - Added test for `getNicifiableKeys` to verify behavior with `Response` objects. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup> for f452b52. You can [customize](https://app.ellipsis.dev/stack-auth/settings/summaries) this summary. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN --> Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
1 parent 04b49f2 commit c7137b6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

packages/stack-shared/src/utils/strings.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,9 @@ import.meta.vitest?.test("nicifyPropertyString", ({ expect }) => {
662662
function getNicifiableKeys(value: Nicifiable | object) {
663663
const overridden = ("getNicifiableKeys" in value ? value.getNicifiableKeys?.bind(value) : null)?.();
664664
if (overridden != null) return overridden;
665+
if (value instanceof Response) {
666+
return ['status', 'headers'];
667+
}
665668
const keys = Object.keys(value).sort();
666669
return unique(keys);
667670
}
@@ -672,6 +675,9 @@ import.meta.vitest?.test("getNicifiableKeys", ({ expect }) => {
672675
// Test empty object
673676
expect(getNicifiableKeys({})).toEqual([]);
674677

678+
679+
expect(getNicifiableKeys(new Response())).toEqual(["status", "headers"]);
680+
675681
// Test object with custom getNicifiableKeys
676682
const customObject = {
677683
a: 1,

0 commit comments

Comments
 (0)