Merge pull request #22160 from dweber019/fix/api-docs-asyncapi

fix: fix custom http resolvers for AsyncAPI widget
This commit is contained in:
Fredrik Adelöw
2024-01-10 16:11:44 +01:00
committed by GitHub
2 changed files with 26 additions and 6 deletions
@@ -143,18 +143,33 @@ const useStyles = makeStyles(theme => ({
},
}));
const fetchResolver = {
order: 199, // Use 199 as the built-in http resolver is 200
canRead: /^https?:\/\//,
async read(file: any) {
const response = await fetch(file.url);
const httpsFetchResolver = {
schema: 'https',
order: 1,
canRead: true,
async read(uri: any) {
const response = await fetch(uri.toString());
return response.text();
},
};
const httpFetchResolver = {
schema: 'http',
order: 1,
canRead: true,
async read(uri: any) {
const response = await fetch(uri.toString());
return response.text();
},
};
const config = {
parserOptions: {
resolve: { fetch: fetchResolver },
__unstable: {
resolver: {
resolvers: [httpsFetchResolver, httpFetchResolver],
},
},
},
};