sending html using api plugin

Hi, is it possible to send content with the mimetype text/html using the api plugin? I would like to expose a small landing page for an external oauth flow.
Solution:
``ts response // @ts-expect-error This should be Mimetypes enum but it currently doesn't have text/html` .setContentType('text/html') .status(HttpCodes.OK)...
Jump to solution
6 Replies
Solution
Favna
Favna•2y ago
response
// @ts-expect-error This should be Mimetypes enum but it currently doesn't have `text/html`
.setContentType('text/html')
.status(HttpCodes.OK)
.end('<html code here>'
response
// @ts-expect-error This should be Mimetypes enum but it currently doesn't have `text/html`
.setContentType('text/html')
.status(HttpCodes.OK)
.end('<html code here>'
And make a PR adding text/html to https://github.com/sapphiredev/plugins/blob/main/packages/api/src/lib/utils/MimeTypes.ts and optionally also a method html to https://github.com/sapphiredev/plugins/blob/main/packages/api/src/lib/structures/api/ApiResponse.ts so you can instead write
response.html(HttpCodes.OK, '<html code here>')
response.html(HttpCodes.OK, '<html code here>')
josh
josh•2y ago
alright, thanks! I'll do that :)
Favna
Favna•2y ago
BTW @vanitasboi
josh
josh•2y ago
😊 posted the PR
Favna
Favna•2y ago
awesome Released v.5.1.0 @vanitasboi
josh
josh•2y ago
that's awesome, thanks a bunch
Want results from more Discord servers?
Add your server