Skip to content

Commit 435d9cd

Browse files
authored
Merge pull request #177 from eosrio/fix/hot-first-response-schema
fix(api): declare hot_first in response schema so it isn't stripped
2 parents 5bacf8c + f0bdf26 commit 435d9cd

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/api/helpers/functions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,7 @@ export function extendResponseSchema(responseProps: any) {
781781
query_time_ms: {type: "number"},
782782
cached: {type: "boolean"},
783783
hot_only: {type: "boolean"},
784+
hot_first: {type: "boolean"},
784785
lib: {type: "number"},
785786
last_indexed_block: {type: "number"},
786787
last_indexed_block_time: {type: "string"},

tests/unit/api-helpers.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ describe('extendResponseSchema', () => {
152152
expect(props.cached).toBeDefined();
153153
expect(props.lib).toBeDefined();
154154
expect(props.total).toBeDefined();
155+
// hot_only / hot_first must be declared or fast-json-stringify silently strips them
156+
// from the response even when the handler sets them.
157+
expect(props.hot_only).toBeDefined();
158+
expect(props.hot_first).toBeDefined();
155159
expect(props.actions).toEqual({ type: 'array' });
156160
});
157161
});

0 commit comments

Comments
 (0)