Home > Web Front-end > JS Tutorial > Detailed explanation of vue-resource interceptor setting header information

Detailed explanation of vue-resource interceptor setting header information

小云云
Release: 2018-01-20 13:13:10
Original
1420 people have browsed it

This article mainly brings you an example of setting header information for vue-resource interceptor. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor to take a look, I hope it can help everyone.

Use vue-resource, set header information:

Vue.http.interceptors.push((request, next) => {
 request.headers.set('Authorization', token)
 console.log(request.headers)
 next(response => {
  console.log(response.status)
  return response
 })
})
Copy after login

Related recommendations:

Vue2.0 axios front-end and back-end login interceptor detailed explanation

vue-resource interceptor setting header detailed explanation

Vue interceptor vue-resource interceptor usage detailed explanation

The above is the detailed content of Detailed explanation of vue-resource interceptor setting header information. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template