Skip to content

Commit

Permalink
fix: crate spec as data/base64 link when ssr
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHotsiy committed Jan 10, 2018
1 parent 9756364 commit 33678e6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/services/models/ApiInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@ export class ApiInfoModel implements OpenAPIInfo {
type: 'application/json',
});
return window.URL.createObjectURL(blob);
} else if (!isBrowser) {
return (
'data:application/octet-stream;base64,' +
new Buffer(JSON.stringify(this.parser.spec, null, 2)).toString('base64')
);
}
return this.parser.specUrl;
}

get downloadFileName(): string | undefined {
if (!this.parser.specUrl && isBrowser && window.Blob && window.URL) {
if (!this.parser.specUrl) {
return 'swagger.json';
}
return undefined;
Expand Down

0 comments on commit 33678e6

Please sign in to comment.