Merge pull request #5805 from urbit/lf/http-api-improvement

@urbit/http-api: surface mark of updates
This commit is contained in:
Hunter Miller 2022-07-15 16:15:36 -05:00 committed by GitHub
commit e37ac116a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -273,7 +273,7 @@ export class Urbit {
) {
const funcs = this.outstandingSubscriptions.get(data.id);
try {
funcs.event(data.json);
funcs.event(data.json, data.mark ?? 'json');
} catch (e) {
console.error('Failed to call subscription event callback', e);
}

View File

@ -148,7 +148,7 @@ export interface SubscriptionInterface {
/**
* Handle %fact
*/
event?(data: any): void;
event?(data: any, mark: string): void;
/**
* Handle %kick
*/

View File

@ -131,8 +131,8 @@ describe('subscription', () => {
await wait(600);
expect(airlock.onOpen).toBeCalled();
expect(params.event).toHaveBeenNthCalledWith(1, firstEv);
expect(params.event).toHaveBeenNthCalledWith(2, secondEv);
expect(params.event).toHaveBeenNthCalledWith(1, firstEv, 'json');
expect(params.event).toHaveBeenNthCalledWith(2, secondEv, 'json');
}, 800);
it('should poke', async () => {
fetchSpy = jest.spyOn(window, 'fetch');