@@ -10,13 +10,15 @@ import React from "react";
1010import { useDoc } from "@docusaurus/plugin-content-docs/client" ;
1111import { usePrismTheme } from "@docusaurus/theme-common" ;
1212import { translate } from "@docusaurus/Translate" ;
13+ import useDocusaurusContext from "@docusaurus/useDocusaurusContext" ;
1314import ApiCodeBlock from "@theme/ApiExplorer/ApiCodeBlock" ;
1415import { useTypedDispatch , useTypedSelector } from "@theme/ApiItem/hooks" ;
1516import SchemaTabs from "@theme/SchemaTabs" ;
1617import TabItem from "@theme/TabItem" ;
1718import { OPENAPI_RESPONSE } from "@theme/translationIds" ;
1819import clsx from "clsx" ;
1920import { ApiItem } from "docusaurus-plugin-openapi-docs/src/types" ;
21+ import type { ThemeConfig } from "docusaurus-theme-openapi-docs/src/types" ;
2022
2123import { clearResponse , clearCode , clearHeaders } from "./slice" ;
2224
@@ -42,7 +44,11 @@ function formatXml(xml: string) {
4244
4345function Response ( { item } : { item : ApiItem } ) {
4446 const metadata = useDoc ( ) ;
47+ const { siteConfig } = useDocusaurusContext ( ) ;
48+ const themeConfig = siteConfig . themeConfig as ThemeConfig ;
4549 const hideSendButton = metadata . frontMatter . hide_send_button ;
50+ const proxy =
51+ metadata . frontMatter . proxy ?? themeConfig . api ?. proxy ;
4652 const prismTheme = usePrismTheme ( ) ;
4753 const code = useTypedSelector ( ( state : any ) => state . response . code ) ;
4854 const headers = useTypedSelector ( ( state : any ) => state . response . headers ) ;
@@ -57,7 +63,7 @@ function Response({ item }: { item: ApiItem }) {
5763 ? "openapi-response__dot--success"
5864 : "openapi-response__dot--info" ) ;
5965
60- if ( ! item . servers || hideSendButton ) {
66+ if ( ( ! item . servers && ! proxy ) || hideSendButton ) {
6167 return null ;
6268 }
6369
0 commit comments