This repository was archived by the owner on Apr 6, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed
packages/nuxt/src/head/runtime Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -197,9 +197,17 @@ export const Meta = defineComponent({
197
197
httpEquiv : String as PropType < HTTPEquiv > ,
198
198
name : String
199
199
} ,
200
- setup : setupForUseMeta ( meta => ( {
201
- meta : [ meta ]
202
- } ) )
200
+ setup : setupForUseMeta ( ( props ) => {
201
+ const meta = { ...props }
202
+ // fix casing for http-equiv
203
+ if ( meta . httpEquiv ) {
204
+ meta [ 'http-equiv' ] = meta . httpEquiv
205
+ delete meta . httpEquiv
206
+ }
207
+ return {
208
+ meta : [ meta ]
209
+ }
210
+ } )
203
211
} )
204
212
205
213
// <style>
Original file line number Diff line number Diff line change @@ -165,6 +165,12 @@ describe('head tags', () => {
165
165
expect ( indexHtml ) . toContain ( '<title>Basic fixture</title>' )
166
166
} )
167
167
168
+ it ( 'should render http-equiv correctly' , async ( ) => {
169
+ const html = await $fetch ( '/head' )
170
+ // http-equiv should be rendered kebab case
171
+ expect ( html ) . toContain ( '<meta content="default-src https" http-equiv="content-security-policy">' )
172
+ } )
173
+
168
174
// TODO: Doesn't adds header in test environment
169
175
// it.todo('should render stylesheet link tag (SPA mode)', async () => {
170
176
// const html = await $fetch('/head', { headers: { 'x-nuxt-no-ssr': '1' } })
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ export default {
35
35
<div >
36
36
<Head >
37
37
<Title >Using a dynamic component</Title >
38
+ <Meta http-equiv =" content-security-policy" content =" default-src https" />
38
39
</Head >
39
40
</div >
40
41
</template >
You can’t perform that action at this time.
0 commit comments