yus*_*efu 6 javascript vue.js axios
我正在尝试设置一个分隔符,在这种情况下:\n
,通过使用 axios 发布数据,不幸的是它包含特殊字符,这些字符在到达 API 时在 params 字符串中转义。它变成了:\\n
//# src/stores/chat_configurations.js
const actions = {
async updateDelimeter ( commit, delimeter) {
console.log(delimeter)
// ":\n"
await axios.put(`/api/chat_configuration`, delimeter: delimeter)
}
}
Run Code Online (Sandbox Code Playgroud)
在发送请求之前它仍然没有改变。":\n"
// # src/lib/api.js
// Add a request interceptor
axios.interceptors.request.use(function (config) {
console.log(config)
// {"delimeter": ":\\n"}"
return config
}, function (error) {
// Do something with request error
return Promise.reject(error)
})
Run Code Online (Sandbox Code Playgroud)
一旦进入拦截器,查询字符串就会被转义。":\\n"
有没有办法使用 axios 禁用查询字符串中的特殊字符转义?
任何帮助将非常感激。