Skip to content

Commit 60c56fe

Browse files
Append the X-KC-SOURCE to customHeaders
1 parent 787eaae commit 60c56fe

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ npm i rxjs --save (because this is a peer dependency of the Kentico Kontent Deli
3232
projectId: 'xxxx-xxx-xxxx-xxxx-xxxxx',
3333
enableAdvancedLogging: false,
3434
previewApiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
35-
enablePreviewMode: true,
35+
globalQueryConfig: {
36+
usePreviewMode: true, // Queries the Delivery Preview API.
37+
},
3638
baseUrl: 'https://custom.uri/api/KenticoKontentProxy',
3739
securedApiKey: 'xxx',
3840
enableSecuredMode: true

lib/templates/plugin.template.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,20 @@ export default (ctx, inject) => {
55
// Create new delivery client Instance
66
let settings = JSON.parse('KENTICOOPTIONS')
77

8-
// Add tracking header
9-
settings = Object.assign({}, settings)
8+
// Adds globalQueryConfig if not already set
9+
if(!settings.globalQueryConfig)
10+
{
11+
settings.globalQueryConfig = {}
12+
}
13+
// Adds customHeaders if not already set
14+
if(!settings.globalQueryConfig.customHeaders)
15+
{
16+
settings.globalQueryConfig.customHeaders = []
17+
}
18+
// Adds X-KC-SOURCE to identify this module is in use
19+
settings.globalQueryConfig.customHeaders.push(
20+
{ header: 'X-KC-SOURCE', value: 'kentico-kontent-nuxt-module' }
21+
);
1022

1123
const deliveryClient = new DeliveryClient(settings)
1224

0 commit comments

Comments
 (0)