Merge pull request #22160 from dweber019/fix/api-docs-asyncapi
fix: fix custom http resolvers for AsyncAPI widget
This commit is contained in:
@@ -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],
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user