node.js - 如何为请求重试添加自定义标头?
问题描述
我的电话是这样的,
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
});
请问在哪里可以添加自定义标题? https://www.npmjs.com/package/requestretry?activeTab=readme
解决方案
const res = await postAsync({
url: "some url",
headers: {...},
json: messageObj, // request body
maxAttempts: 5,
retryDelay: 1000
});
推荐阅读
- generics - 协变(输出)和泛型类型 kotlin
- aws-lambda - AWS Lambda Dynamo AWS SDK Node.js 查询方法问题
- python - ttk Combobox 以编程方式和动态设置背景颜色
- python - 拆分列表后加入相关项目
- webpack - Webpack mini-css-extract-plugin 未加载主 css 包
- c# - 延迟 ViewModel 属性初始化
- html - 光标与按钮的 CSS 交互
- php - PHP:替换网址的第一部分
- angular - TypeScript 中默认的通用约束
- swift - UIBarButtonItem 选择器不起作用