亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - Why do many projects serialize the data in the request body before sending a post request?
天蓬老師
天蓬老師 2017-06-15 09:23:20
0
2
1019

I found that many projects use "querystring parsing and stringifying library" to serialize the data to be transmitted in post requests, such as qs.

//POST傳參序列化(添加請(qǐng)求攔截器)
axios.interceptors.request.use((config) => {
    //在發(fā)送請(qǐng)求之前做某件事
    if(config.method  === 'post'){
        config.data = qs.stringify(config.data);
    }
    return config;
},(error) =>{
     _.toast("錯(cuò)誤的傳參", 'fail');
    return Promise.reject(error);
});

There is a sentence in the introduction in qs: "A querystring parsing and stringifying library with some added security." May I ask where the safety is reflected?

天蓬老師
天蓬老師

歡迎選擇我的課程,讓我們一起見(jiàn)證您的進(jìn)步~~

reply all(2)
伊謝爾倫

Look at the test cases of qs and you will know https://github.com/ljharb/qs/...

The security value is that the data you construct is legal.

曾經(jīng)蠟筆沒(méi)有小新

The comment was written in the wrong place qs Is this library mainly used to detect whether the data is legal? Because if I used jQuery and axios before, I could still send ajax requests even if I didn’t add the qs library.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template