asxios--form data提交,setcookie

來源:互聯網
上載者:User

標籤:roc   RoCE   his   ted   console   app   踩坑   com   ext2   

React native 項目,部分介面用form data 提交,以及在Android端,雖然設定了請求攜帶cookie,但每次請求攜帶的cookie跟初始化時都不一樣,目前做法是去到初始化中返回的userID儲存下來,set到後面請求的cookie中,代碼如下:

axios.post(‘http://103.28.215.253:10528/knowledge/chat/process‘,"content="+a,{    headers:{        ‘Content-Type‘:‘application/x-www-form-urlencoded‘,        "Cookie" : ‘uid=‘ + this.state.uid,//設定cookie    },    withCredentials: true,//佈建要求帶cookie}).then(res=>{    console.log(res)    if(res.data.data.code == 200){        this.addItem(res.data.data.content,1,false,res.data.data.selectedItems)        const s = new Sound("https://tsn.baidu.com/text2audio?lan=zh&ctp=1&cuid=%22sungeliang_shilihuan_gaoyizhen%22&tok=24.05a4f5f9561eee95708da8c069b63053.2592000.1532508020.282335-11276997&tex="+res.data.data.content+"&vol=9&per=0&spd=5&pit=5",null,(e)=>{            if (e){                console.log(‘播放失敗‘)                return            }            s.play(()=>s.release())        })    }})

  

RN項目目前踩坑階段,

asxios--form data提交,setcookie

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.