#sending html using api plugin

1 messages · Page 1 of 1 (latest)

dark crescent
#

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.

dense ocean
#
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>')
dark crescent
#

alright, thanks! I'll do that :)

broken fieldBOT
#

Thank you for marking this question as solved!

Question Message ID

1118132837376327691

Solution Message ID

1118139978342473749

dense ocean
dark crescent
#

😊 posted the PR

dense ocean
#

awesome

dense ocean
#

Released v.5.1.0 @dark crescent