简体   繁体   中英

How to add custom header for requestretry?

My call is like this,

const { get, post } = require('requestretry');
const { promisify } = require('util');
const [getAsync, postAsync] = [get, post].map(promisify);

    const res = await postAsync({
        url: "some url",
        json: messageObj, // request body
        maxAttempts: 5,
        retryDelay: 1000
    });

Where can i add custom header please? https://www.npmjs.com/package/requestretry?activeTab=readme

const res = await postAsync({
    url: "some url",
    headers: {...},
    json: messageObj, // request body
    maxAttempts: 5,
    retryDelay: 1000
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM