Skip to content

Commit

Permalink
[fix] fmt from previous PR (#140)
Browse files Browse the repository at this point in the history
* [fix] fmt for the previous PR
* added test verifying contributed header
  • Loading branch information
aricart committed Apr 5, 2021
1 parent 0b64ff9 commit 6b25e37
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nats-base-client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export interface JetStreamPublishOptions {
msgID: string;
timeout: number;
ackWait: Nanos;
headers: MsgHdrs
headers: MsgHdrs;
expect: Partial<{
lastMsgID: string;
streamName: string;
Expand Down
20 changes: 20 additions & 0 deletions tests/jetstream_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
delay,
Empty,
ErrorCode,
headers,
JsMsg,
JsMsgCallback,
JSONCodec,
Expand Down Expand Up @@ -1299,6 +1300,25 @@ Deno.test("jetstream - cross account pull", async () => {
await cleanup(ns, admin, nc);
});

Deno.test("jetstream - publish headers", async () => {
const { ns, nc } = await setup(jetstreamServerConf({ debug: true }, true));
const { stream, subj } = await initStream(nc);
const jsm = await nc.jetstreamManager();
await jsm.consumers.add(stream, {
durable_name: "me",
ack_policy: AckPolicy.Explicit,
});
const js = nc.jetstream();
const h = headers();
h.set("a", "b");

await js.publish(subj, Empty, { headers: h });
const ms = await js.pull(stream, "me");
ms.ack();
assertEquals(ms.headers!.get("a"), "b");
await cleanup(ns, nc);
});

// Deno.test("jetstream - cross account fetch", async () => {
// const { ns, nc: admin } = await setup(
// jetstreamExportServerConf(),
Expand Down

0 comments on commit 6b25e37

Please sign in to comment.