在nuxtjs中使用axios向api发出的HTTP发布请求,其中显示net :: ERR_HTTP2_PROTOCOL_ERROR

时间:2019-11-24 18:11:52

标签: api axios

我已经使用lumen制作了一个API,所有POST,GET方法在本地主机上都运行良好,并且在托管在实时服务器上时也可以运行GET请求,但不幸的是POST请求无法正常工作,并且显示错误 net :: ERR_HTTP2_PROTOCOL_ERROR POST请求在POSTMAN中运行良好

async submitForm(){
        const config = {
            headers: { 'content-type': 'application/json','Accept':'application/json','Access-Control-Allow-Origin':'*'}
        }
        let formData = new FormData();
        formData.append('name', this.name);
        formData.append('email', this.email);
        formData.append('phone', this.phone);
        formData.append('message', this.message);
        await this.$axios.$post('https://myurl',formData,config)
        .then((response) => {
            this.success = 'Thank you !!';
           
        })
        .catch((error) => {
            this.error = 'Unable to submit . Please try again later .';
        });
    }

0 个答案:

没有答案