ErrTypeInvalidHeaderFormat(日期标头要求RFC1123 <day-name>,<day> <month> <year> <hour>:<minute>:<second> GMT)

时间:2019-02-15 04:05:19

标签: javascript jquery fetch

我已经在脚本中为RFC1123日期编码,但是仍然出错。 有什么想法吗?

这是我的代码:

    const proxyurl = "https://cors-anywhere.herokuapp.com/";
    const url1 = "www.examples.com";
    const date1 = new Date().toUTCString();
    const auth = <?=$Auth?>;
    const Data = {
        name:"test",
        id:23
    }
    const param = {
        headers:{
            'Content-type':'application/json',
            'Date': new Date().toUTCString(),
            'Authorization':auth
        },
        body:Data,
        method:"POST"
    };
    fetch(proxyurl + url1,param)
    .then(response => response.text())
    .then(contents => console.log(contents))
    .catch(() => console.log("Can’t access " + url1 + " response. Blocked by browser?"))

这是我代码中的结果错误:

{"type": "ErrTypeInvalidHeaderFormat", "message":"date header requires RFC1123 <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT"}

0 个答案:

没有答案