Move ~scalar/proxy route to site route group (#4083)

This commit is contained in:
Nolann B.
2026-03-05 19:06:06 +01:00
committed by GitHub
parent 9f4d93502e
commit eceec6f641
6 changed files with 22 additions and 3 deletions
@@ -53,6 +53,7 @@ export function ScalarApiButton(props: {
<ScalarModal
controllerRef={controllerRef}
withProxy={withProxy}
proxyUrl={context.proxyUrl}
method={method}
path={path}
securities={securities}
@@ -73,9 +74,11 @@ function ScalarModal(props: {
servers: OpenAPIOperationData['servers'];
specUrl: string;
withProxy: boolean;
proxyUrl?: string;
controllerRef: React.Ref<ScalarModalControllerRef>;
}) {
const { method, path, securities, servers, specUrl, withProxy, controllerRef } = props;
const { method, path, securities, servers, specUrl, withProxy, proxyUrl, controllerRef } =
props;
const getPrefillInputContextData = useOpenAPIPrefillContext();
const prefillInputContext = getPrefillInputContextData();
@@ -90,7 +93,7 @@ function ScalarModal(props: {
configuration={{
url: specUrl,
...prefillConfig,
proxyUrl: withProxy ? '/~scalar/proxy' : undefined,
proxyUrl: withProxy ? proxyUrl : undefined,
}}
initialRequest={{ method: toScalarHttpMethod(method), path }}
>
+6
View File
@@ -34,6 +34,11 @@ export interface OpenAPIClientContext {
*/
id?: string;
/**
* The URL for the Scalar proxy endpoint.
*/
proxyUrl?: string;
/**
* Mark the context as a client context.
*/
@@ -97,6 +102,7 @@ export function getOpenAPIClientContext(context: OpenAPIUniversalContext): OpenA
defaultInteractiveOpened: context.defaultInteractiveOpened,
blockKey: context.blockKey,
id: context.id,
proxyUrl: context.proxyUrl,
$$isClientContext$$: true,
};
}