Skip to content
Permalink
Browse files

feat: convert header names to lowercase (nuxt/http#45)

  • Loading branch information...
pi0 committed May 22, 2019
1 parent 90e8c13 commit 2e514a44b832c5de61f656ed91713b57d0a017eb
Showing with 4 additions and 2 deletions.
  1. +3 −1 lib/plugin.js
  2. +1 −1 test/fixture/pages/ssr.vue
@@ -4,6 +4,8 @@ import Axios from 'axios'
// Axios.prototype cannot be modified
const axiosExtra = {
setHeader (name, value, scopes = 'common') {
name = name.toLowerCase()

for (let scope of Array.isArray(scopes) ? scopes : [ scopes ]) {
if (!value) {
delete this.defaults.headers[scope][name];
@@ -14,7 +16,7 @@ const axiosExtra = {
},
setToken (token, type, scopes = 'common') {
const value = !token ? null : (type ? type + ' ' : '') + token
this.setHeader('Authorization', value, scopes)
this.setHeader('authorization', value, scopes)
},
onRequest(fn) {
this.interceptors.request.use(config => fn(config) || config)
@@ -12,7 +12,7 @@ let reqCtr = 1
export default {
computed: {
axiosSessionId() {
return this.$axios.defaults.headers.common.sessionId
return this.$axios.defaults.headers.common.sessionid
},
axiosEncoding() {

0 comments on commit 2e514a4

Please sign in to comment.
You can’t perform that action at this time.