Skip to content

Commit

Permalink
fix(nuxt): pass correct array
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Jul 27, 2020
1 parent 4075289 commit ecb88ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions nuxt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const MandeModule = function NuxtMandeModule(localOptions) {
this.addPlugin({
src: path.resolve(__dirname, 'plugin.js'),
fileName: 'mande.js',
// FIXME: figure out why options end up being undefined
options,
})
}
13 changes: 11 additions & 2 deletions nuxt/plugin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/** @type {import('@nuxt/types').Plugin} */
export default (ctx, inject) => {
function mande(wrappedFn, ...args) {
Expand All @@ -10,8 +9,18 @@ export default (ctx, inject) => {

const reqHeaders = { ...ctx.req.headers }

const proxyHeadersIgnore = <%= serialize(options.proxyHeadersIgnore) %> || [
'accept',
'host',
'cf-ray',
'cf-connecting-ip',
'content-length',
'content-md5',
'content-type',
]

// @ts-ignore
for (let header of <%= serialize(options.proxyHeadersIgnore) %>) {
for (let header of proxyHeadersIgnore) {
delete reqHeaders[header]
}

Expand Down

0 comments on commit ecb88ce

Please sign in to comment.