Axios - 错误:请求失败,状态码为 503

时间:2021-02-22 05:38:32

标签: node.js axios http-status-code-503

嗨,我正在尝试在服务器端(节点 js)上使用 axios 并调用 post 请求。下面是我的代码。当我使用邮递员时它工作正常,但是当从节点 js 命中时它给出 503(服务不可用)。我在这里做错了什么吗?

    try {
        const sendInvitePayload = {
            UID: "132465789",
            invitees: [
                "9200000000"
            ],
            customerType: "consumer"
        }

        const sendInviteOptions = {
            method: 'post',
            url: "http://xxxxxxx,
            headers: headers,
            data: sendInvitePayload
        };

        logger.info({
            event: 'send invite request to non jazz cash user options',
            functionName: 'sendMoneyService.confirmNonJcPaymentC2C',
            data: sendInviteOptions,
        });

        const inviteResponse = await axios(sendInviteOptions);
        console.log(inviteResponse)
    } catch (error) {

        logger.error({
            event: 'Failure : Exited function',
            functionName: 'sendMoneyService.confirmNonJcPaymentC2C',
            error: { message: error.message, stack: error.stack },
        });

        return false;

    }

0 个答案:

没有答案