Skip to content

How to add custom headers with requestClient? #11

@lucfirely

Description

@lucfirely

How can I send custom/extra headers with requestClient?

To clarify I mean the headers in sendContext.ts

let client = bus.requestClient<SubmitOrder, OrderSubmitted>({
    exchange: "orders",
    requestType: new MessageType("SubmitOrder"),
    responseType: new MessageType("OrderSubmitted"),
})

const submitOrder = setInterval(async () => {
    try {
        let response = await client.getResponse({OrderId: Guid.create().toString(), Amount: 123.45})

        console.log("Order submitted", response.message.OrderId)
    }
    catch (e) {
        console.error("failed to submit order", e.message)
    }
}, 1000)

Example code above is from MassTransit/Sample-Node

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions