Changed config and header names as per @bastienwirtz feedback

This commit is contained in:
Evan Steinkerchner 2022-04-19 20:24:51 -04:00
parent 33f75a798a
commit 240e3f0e87

View File

@ -3,6 +3,7 @@ const merge = require("lodash.merge");
export default { export default {
props: { props: {
proxy: Object, proxy: Object,
forwarder: Object,
}, },
created: function () { created: function () {
// custom service often consume info from an API using the item link (url) as a base url, // custom service often consume info from an API using the item link (url) as a base url,
@ -27,9 +28,9 @@ export default {
this.item.useCredentials === true ? "include" : "omit"; this.item.useCredentials === true ? "include" : "omit";
} }
if (this.proxy?.apikey) { if (this.forwarder?.apikey) {
options.headers = { options.headers = {
"X-Homer-Api-Key": this.proxy.apikey, "X-Homer-Forwarder-Api-Key": this.forwarder.apikey,
}; };
} }
@ -39,12 +40,12 @@ export default {
let url = path ? `${this.endpoint}/${path}` : this.endpoint; let url = path ? `${this.endpoint}/${path}` : this.endpoint;
if (this.proxy?.url) { if (this.forwarder?.url) {
options.headers = { options.headers = {
...(options.headers || {}), ...(options.headers || {}),
"X-Homer-Api-Url": url, "X-Homer-Forwarder-Url": url,
}; };
url = this.proxy.url; url = this.forwarder.url;
} }
options = merge(options, init); options = merge(options, init);