Skip to content

Commit 0beda3b

Browse files
authored
Endpoint: move HTTP header to a GET parameter (#138)
Send `api-version=` querystring parameter instead of a HTTP header `X-RTD-Hosting-Integrations-Version` as discussed. * Requires: readthedocs/readthedocs.org#10753
1 parent db9f96d commit 0beda3b

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

dist/readthedocs-addons.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/readthedocs-addons.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/readthedocs-config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CLIENT_VERSION } from "./utils";
1+
import { CLIENT_VERSION, ADDONS_API_VERSION } from "./utils";
22

33
/**
44
* Load Read the Docs configuration from API endpoint.
@@ -9,6 +9,8 @@ export function getReadTheDocsConfig() {
99
"/_/addons/?" +
1010
new URLSearchParams({
1111
url: window.location.href,
12+
"client-version": CLIENT_VERSION,
13+
"api-version": ADDONS_API_VERSION,
1214
});
1315

1416
// Retrieve a static JSON file when working in development mode
@@ -18,7 +20,6 @@ export function getReadTheDocsConfig() {
1820

1921
return fetch(url, {
2022
method: "GET",
21-
headers: { "X-RTD-Hosting-Integrations-Version": CLIENT_VERSION },
2223
}).then((response) => {
2324
if (!response.ok) {
2425
console.debug("Error parsing configuration data");

src/utils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export function isReadTheDocsEmbedPresent() {
1111
}
1212

1313
export const CLIENT_VERSION = packagejson.version;
14+
export const ADDONS_API_VERSION = "0";
1415

1516
export const domReady = new Promise((resolve) => {
1617
if (

0 commit comments

Comments
 (0)